Trimming Excess Digits After Calculations
Posted: Sat Feb 28, 2004 5:59 pm
I have a MYSQL Database which holds "Miles Per Gallon, etc" info on my vehicles.
I do queries to determine total fuel purchased, total miles driven, etc. and do division computations and post the result to a table.
When I do something like:
$AverMPG = $TotalMiles / $GalPurchased
Then print $AverMPG to a cell in my table I get a result like:
16.584752
Where and how do I trim it down to one or two numbers after the decimel.
I do queries to determine total fuel purchased, total miles driven, etc. and do division computations and post the result to a table.
When I do something like:
$AverMPG = $TotalMiles / $GalPurchased
Then print $AverMPG to a cell in my table I get a result like:
16.584752
Where and how do I trim it down to one or two numbers after the decimel.