Solved

Problems with a new error with number_format

Posted on 2014-07-20
4
124 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
Comment Utility
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
Comment Utility
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
Comment Utility
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 108

Accepted Solution

by:
Ray Paseur earned 500 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Router for PHP reqeusts 12 29
Use PHP to save or display image returned by JSON call. 20 44
Button Click 11 22
update field on focusout 15 19
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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 look for a specific file type in a local or remote server directory using PHP.

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now