Solved

Problems with a new error with number_format

Posted on 2014-07-20
4
126 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 109

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

777 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