Solved

Problems with a new error with number_format

Posted on 2014-07-20
4
130 Views
Last Modified: 2014-08-13
I have code that did work.  Now I'm getting this error from the page:

Warning: number_format() expects parameter 1 to be double, string given in /home/mrbreeze/public_html/chris/Survey_Display.php on line 411

The code in the php is:
411:                  $work = number_format("$ROW[STORE]");
412:                  echo $work;
413:                  echo "<br>";

WTF?
0
Comment
Question by:breeze351
  • 2
4 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40207719
What is the value of $ROW[STORE]

Is STORE a variable? If not it should be like
$ROW['STORE']
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 40207736
First try $work = number_format("$ROW[STORE]")
to be $work = number_format($ROW[STORE]);
If still not, probably, $ROW[STORE] array is  NOT matched to number of store, STORE constant, so you need to check the method how you save any data in $ROW[STORE]

If okay, please provide more code around data operation for $ROW[STORE]

Duncan
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 40207740
Could you print out $ROW[STORE] by print_r($ROW)  and echo count($ROW) in php
to see whether it is matched to STORE or not ?

Duncan
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 40207779
How to use quotes in PHP?  
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_12241-Quotation-Marks-in-PHP.html

Try it like this:

$work = number_format($ROW['STORE']);

Add error_reporting(E_ALL) to the top of all of your PHP scripts so PHP will tell you about these errors instead of silently disguising them!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question