Jump to content

trailing zeros


hmark

Recommended Posts

Hello again. How can i trim my results to only include two decimal points?

I'm using the following:

 

<?

while($row = mysql_fetch_array($res) )

{

$ind_pred_rate=$row[3]/114155*100;

$outd_pred_rate=$row[4]/114155*100;

$target_rate=$row[6]/114155*100;

print  "<tr>\n";

print  "<td valign=\"top\">{$row[0]}</td>\n";

print  "<td valign=\"top\">{$row[1]}</td>\n";

print  "<td valign=\"top\"> {$row[2]} </td>\n";

print  "<td valign=\"top\">{$row[3]}</td>\n";

print  "<td valign=\"top\">{$ind_pred_rate}</td>\n";

print  "<td valign=\"top\">{$row[4]}</td>\n";

print  "<td valign=\"top\">{$outd_pred_rate}</td>\n";

print  "<td valign=\"top\">{$row[5]}</td>\n";

print  "<td valign=\"top\">{$row[6]}</td>\n";

print  "<td valign=\"top\">{$target_rate}</td>\n";

print  "<td valign=\"top\">{$row[7]}</td>\n";

print  "</tr>\n";

}

?>

 

The results of $ind_pred_rate, $outd_pred_rate, and $target_rate are 14 decimal points or more. Any suggestions here?

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/187742-trailing-zeros/
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.