为什么我不能总结这个代码只显示总收入的最后一个收入:如何正确总结?
<table border="1">
<tr>
<th>Date</th>
<th>Route</th>
<th>Destination</th>
<th>Van No.</th>
<th>Waybill No.</th>
<th>Charge Invoice</th>
<th>Revenue</th>
<th>Strip/Stuff</th>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_PK['delivery_details_date']; ?></td>
<td><?php echo $row_PK['delivery_details_route']; ?></td>
<td><?php echo $row_PK['delivery_details_destination']; ?></td>
<td><?php echo $row_PK['delivery_details_van_no']; ?></td>
<td><?php echo $row_PK['delivery_details_waybill_no']; ?></td>
<td><?php echo $row_PK['delivery_details_charge_invoice']; ?></td>
<td><?php echo $row_PK['delivery_details_revenue']; ?></td>
<td><?php echo $row_PK['delivery_details_strip_stuff']; ?></td>
<?php $revenue = $row_PK['delivery_details_revenue'];
$sum += $revenue;?>
</tr>
<?php } while ($row_PK = mysql_fetch_assoc($PK));?>
</table>
TOTAL: <?php echo $revenue; ?> <br/>
TOTAL 只显示最后记录的收入它没有添加所有这些为什么?