在我的
PHP中,
while($info3 = MysqL_fetch_array($result3)){ $Name = $info3["Name"]; $Address = $info3["Address"]; $Age = $info3["Age"]; // ----------------------------------------------------------------------------- $tbl = ' <table style="width: 638px;" cellspacing="0"> <tr> <td style="border: 1px solid #000000; width: 150px;">'.$Name.'</td> <td style="border: 1px solid #000000; width: 378px;">'.$Age.'</td> <td style="border: 1px solid #000000; width: 110px; text-align:center">'.$Address.'</td> </tr> </table> '; $pdf->writeHTML($tbl,true,false,''); }
始终在我的pdf中打印整个表格.但我想打印< table>和< / table>对于单个实例,然后想要循环打印其间的行.我怎么解决这个?
$tbl_header = '<table style="width: 638px;" cellspacing="0">'; $tbl_footer = '</table>'; $tbl = ''; // foreach item in your array... $tbl .= ' <tr> <td style="border: 1px solid #000000; width: 150px;">'.$Name.'</td> <td style="border: 1px solid #000000; width: 378px;">'.$Age.'</td> <td style="border: 1px solid #000000; width: 110px; text-align:center">'.$Address.'</td> </tr> '; $pdf->writeHTML($tbl_header . $tbl . $tbl_footer,'');