有朋友讲过这种方法,可我没弄懂,他讲的是:
$Counter = 0;这个写在while()前面
然后在循环里面:$Counter++;  
if($Counter ==5){ 打印$TotalAmount; $Counter =0; $TotalAmount =0 }
原代码片断:
if (DB_num_rows($result)>0){
/*Yes there are line items to start the ball rolling with a page header */
include('includes/PDFOrderPageHeader_generic.inc');
$TotalAmount = 0;while ($myrow2=DB_fetch_array($result)){  $ListCount ++;
$DisplayQty = number_format($myrow2['quantity'],2);/*数量*/
$DisplayPrevDel = number_format($myrow2['unitprice']*$myrow2['quantity'],2);/*金额*/
$DisplayQtySupplied = number_format($myrow2['unitprice'],2);/*单价*/  
$TotalAmount = $TotalAmount +$DisplayPrevDel; /*累计*/
$LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize,$myrow2['stkcode']);
$LeftOvers = $pdf->addTextWrap(135,$YPos,255,$FontSize,$myrow2['description']);
$LeftOvers = $pdf->addTextWrap(220,$YPos,85,$FontSize,$DisplayQty,'right');
$LeftOvers = $pdf->addTextWrap(300,$YPos,85,$FontSize,$DisplayQtySupplied,'right');
$LeftOvers = $pdf->addTextWrap(350,$YPos,85,$FontSize,$DisplayPrevDel,'right');
$LeftOvers = $pdf->addTextWrap(425,$YPos,85,$FontSize,$TotalAmount,'right');$pdf->addText(200, 526-135,$FontSize, XXXX我要显示的总计金额,'right'); /*总计金额小写*/