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
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..
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.