Jump to content

Displaying Decimal values


yogurt

Recommended Posts

Hi Guys

Hope 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 quote
WHERE qtno = colname

The 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

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.