aaronlzw_21 Posted May 8, 2006 Share Posted May 8, 2006 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! Quote Link to comment Share on other sites More sharing options...
ober Posted May 8, 2006 Share Posted May 8, 2006 You have to use number_format() to display any kind of precision, unless MySQL provides a number formatting function. Quote Link to comment Share on other sites More sharing options...
aaronlzw_21 Posted May 9, 2006 Author Share Posted May 9, 2006 [!--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.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.