売上・経費・入金の合計を自動計算したい
<?php
$result = mysql_query("select * from new");
$x = 0;
while($row = mysql_fetch_assoc($result))
{
?>
<tr>
<td><?php echo $row["D_date"]; ?></td>
<td><?php echo $row["D_id"]; ?></td>
<td><?php echo $row["D_item"]; ?></td>
<td><?php echo $row["D_sales"]; ?></td>
<td><?php echo $row["D_expenses"]; ?></td>
<td><?php echo $row["D_bankin"]; ?></td>
</tr>
<?php
$x++;
}
?>
<?php
$result1 = mysql_query("select * from new");
while($row1 = mysql_fetch_assoc($result1))
{
?>
<tr>
<td colspan="3">Total</td>
<td><?php echo $row1["D_totalsales"]; ?> </td>
<td><?php echo $row1["D_totalexpenses"]; ?></td>
<td><?php echo $row1["D_totalbankin"]; ?></td>
</tr>
<?php
}
?>
ありがとうございました