yogurt Posted November 27, 2006 Share Posted November 27, 2006 Hi GuysHope somebody can help me here. I am battling to get data to show correctly. Basicall I have a record set which looks like this:SELECT SUM(cost)FROM quoteWHERE qtno = colnameThe record set name is rsTotalVat, mysql adds up the value of the numbers in the cost column, which works fine, but I have this in my code to display 2 decimal points:echo round ($row_rsTotalvat['SUM(cost)'], 2);It will appear correctly if the result of the sum was for example 123.45 but if the sums result was 123.40 it will display as 123.4 which is not what I want. How can I get this to work.I hope I have supplied or the required info here.Many Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/28622-displaying-decimal-values/ Share on other sites More sharing options...
kenrbnsn Posted November 27, 2006 Share Posted November 27, 2006 Use the function [url=http://www.php.net/number_format]number_format()[/url]Ken Link to comment https://forums.phpfreaks.com/topic/28622-displaying-decimal-values/#findComment-130927 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.