我创建了一个表,可以获得缺少员工的日子,现在我试图添加一行作为计算每列总数的总计..但我不知道该怎么做。有什么帮助吗?
echo ' <div>
<table>
<tr>
<th>Month</th><th>Vacations</th>
</tr>';
for($i=1;$i<=12;$i++){
echo '<tr>
<td>'.getCount($id,$year,$i,'Vacation').'</td>
</tr>
';
}
echo '</table>
</div>';
答案 0 :(得分:1)
$WeeklyVacationCount = 0;
//.........other td
环
for($i=1;$i<=12;$i++){
$WeeklyVacation = getCount($afnbr,$year,$i,'WeeklyVacation');
$WeeklyVacationCount+=$WeeklyVacation;
echo "<td>{$WeeklyVacation}</td>";
//.........other td
循环后
echo "<tr>";
echo "<td>{$WeeklyVacationCount}</td>";
echo "</tr>";
//.........other td