...

View Full Version : Need help returning value as decimal



chibul
02-08-2010, 01:40 AM
Trying to modify this code slightly to allow the returned value to be in decimal format.


$min=number_format(mysql_result($result,$i,"minutes"));

In this instance, the value in the database is 40.5, but is returning as 41. What do I need to add to that line of code to get it to display correctly as 40.5?

MattF
02-08-2010, 01:47 AM
Stop formatting it with the number_format function?

chibul
02-08-2010, 01:51 AM
Tried that...changed it to
$min=(mysql_result($result,$i,"minutes")); and still nothing.

chibul
02-08-2010, 01:53 AM
Nevermind...I'm a dolt. LOL

Thanks!

MattF
02-08-2010, 01:55 AM
That should be:



$min=mysql_result($result,$i,"minutes");


If it's 40.5 in the DB, and changing that line makes no difference, then the number is being rounded somewhere else.


Edit: Just seen your other post. Pipped whilst composing the post. :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum