私はテーブルを持っreservation
ていpostflight
ます。テーブルでクエリを実行し、reservation
テーブル内のデータを探す必要がありpostflight
ます。
$query="select * from reservation where date(fdate) between '$datefrom' and '$dateto' and status in ('Flown') $aircraft order by $sort";
$result=mysql_query($query) or die(mysql_error());
echo "<div class='box'><table class='hovertable'>
<th>Flight Date</th>
<th>Client Name</th>
<th>Group Code</th>
<th>Aircraft</th>
<th>Block Time</th>
<th>Waiting Time</th>
<th>Charter Fee</th>
<th>Take-off and Landing Fee</th>
<th>Waiting Time Fee</th>
<th>Other Charges</th>
<th>Sub-Total</th>
<th>Value-added Tax</th>
<th>Total Service Invoice Amount</th>
<th>Reservation No.</th>
</tr>";
while($row=mysql_fetch_array($result))
{
$rvno=$row['reservno'];
$yr=(string) date("Y");
$rn=$yr."-".$rvno;
$a=mysql_query("select *, (fdf + fce + aef + hf + sfp) as 'tcharge' from postflight where reservno='$rvno'") or die(mysql_error());
//$e=mysql_fetch_array($a);
while($b=mysql_fetch_array($a))
{
echo"<tr><td>".$row['fdate']."</td><td>".$b['cliename']."</td><td>".$row['grpcode']."</td><td>".$row['acode']."</td><td>".$row['btime']."</td><td>".$b['wtime']."</td><td>".$b['total_cfee']."</td><td>".$b['total_tol']."</td><td>".$b['total_wtfee']."</td><td>".$b['tcharge']."</td><td>".$b['sub_total']."</td><td>".$b['vat']."</td><td>".$b['total_service_invoice_amt']."</td><td>".$rn."</td></tr>";
}
}
を閉じる前に</table>
、上記のクエリの出力データに基づいて、合計する必要があるすべてのフィールドを合計する別の行を追加したいと思います。何かのようなもの、
echo "<tr><td colspan='6'></td><td><b>sum</b></td><td><b>sum</b></td><td><b>sum</b></td><td><b>sum</b></td><td><b>sum</b></td><td><b>sum/b></td><td><b>sum</b></td><td></td></tr>";
しかし、私はそれを行う方法がわかりません。助けてください。ありがとう。