我遇到了FPDF问题,我想创建一个While循环,它返回我的SQL查询在使用Phpmyadmin时执行的每个结果,此处的问题是它只返回一个。如果我使用
$ pdf-> Cell(190,10,''。$ pdf_info2 ['format']。'',1,1,0); 它确实打印出我想要的结果,但我需要将它们返回到表格中,如下所示。 Ps:这是我的firts问题,所以我很抱歉如果我不清楚o我的问题。 在此先感谢while FPDF中的循环仅打印1结果
$html='<table border="0">
<tr>
<td width="150" height="40" bgcolor="#e6e6e6">Tipo</td>
<td width="150" height="40" bgcolor="#e6e6e6">Formato</td>
<td width="150" height="40" bgcolor="#e6e6e6"> </td>
<td width="150" height="40" bgcolor="#e6e6e6">Pago</td>
<td width="150" height="40" bgcolor="#e6e6e6">Editar</td>
</tr>';
while($pdf_info2 = $smth->fetch(PDO::FETCH_ASSOC)) {
$html2 = '<tr>
<td width="150" height="40" bgcolor="#e6e6e6">'.$pdf_info['format'].'</td>
<td width="150" height="40" bgcolor="#e6e6e6">.$pdf_info['format'].</td>
<td width="150" height="40" bgcolor="#e6e6e6">.$pdf_info['format'].</td>
<td width="150" height="40" bgcolor="#e6e6e6">.$pdf_info['format'].</td>
<td width="150" height="40" bgcolor="#e6e6e6">.$pdf_info['format'].</td>
</tr>';
}
$pdf->WriteHTML($html);
$pdf->WriteHTML($html2);
'$ HTML2。='请参阅点在'='前面? –
而'$ pdf_info ['format']'应该是'$ pdf_info2 ['format']''。 –