Jump to content

data retrieve from mysql is not in double


aaronlzw_21

Recommended Posts

hi i have a small prob here. mysql table's column is in decimal with two decimal places. to store prices. i used a for loop to display the results in a form of a html table. but the results shown are always without the decimal places. did i do something wrong? here are my codes,

$queryResult = mysql_query($query)
$results = mysql_num_rows($queryResult)

for ($i=0; $i<$results; i++){
$row = mysql_fetch_array($queryResult);

echo "<td>". $row['monthlyCost']. "</td>";


}


its not the complete code but its something like that. thanks!
Link to comment
https://forums.phpfreaks.com/topic/9291-data-retrieve-from-mysql-is-not-in-double/
Share on other sites

[!--quoteo(post=372274:date=May 8 2006, 10:35 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 8 2006, 10:35 PM) [snapback]372274[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You have to use number_format() to display any kind of precision, unless MySQL provides a number formatting function.
[/quote]


erm i dun get wat u mean..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.