如何圆形图mysql结果值
$earnedbasic=$runrows['salary']/$runrows['days']*$runrows['countdaystotal'];
示例:薪水除以天数乘以工作日
150 salary
29 days
30 workingdays
150/29x30=155.17241
如果结果是那样的话 所以我想要圆形数值示例现在155.17241,我只想要那个155.173 请帮我解决这个问题
<?php
while ($runrows = mysql_fetch_assoc($run))
{
//get data
$workerid = $runrows['workerid'];
$keywords = $runrows['keywords'];
$salary = $runrows['salary'];
$days = $runrows['days'];
$countdaystotal = $runrows['countdaystotal'];
$earnedbasic=$runrows['salary']/$runrows['days']*$runrows['countdaystotal'];
echo "<table class='sortable' border='1' cellpadding='10'>";
echo "<tr> <th>ID</th> <th>Name</th><th>Basic</th><th>Days</th> <th>Earned Basic</th><th>Total Salary</th></tr>";
echo "<tr width='50%' onmouseover=\"this.style.backgroundColor='#999999';\" onmouseout=\"this.style.backgroundColor='#d4e3e5';\"><td width='20%'><a href=\"detail.php?id=$id\" class=\"style1\">$workerid</a></td>
<td width='20%'>$keywords</td>
<td width='20%'>$salary</td>
<td width='20%'>$countdaystotal</td>
<td width='20%'>$earnedbasic</td></tr>";
echo "</table>";
}
}
}
?>
答案 0 :(得分:2)
呃... round($earnedbasic,3)
应该这样做。
答案 1 :(得分:0)
<td width='20%'>".round($earnedbasic, 3)."</td>
或
$earnedbasic=round($runrows['salary']/$runrows['days']*$runrows['countdaystotal'],3);