Solved

Problems with a new error with number_format

Posted on 2014-07-20
4
132 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: 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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

739 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