0
I’m putting together a PDF by MPDF, using a HTML. But he has printando only the last result and should printar all, for it is within one foreach. How to make it to print all the result one in each row.
<?php
foreach ($results as $k => $v) {
$html = '
<html>
<head>
</head>
<body>
<table class="flat-table">
<tr>
<th>Nosso Numero</th>
<th>Ocorrencia</th>
<th>Vlr Boleto</th>
<th>Matricula</th>
<th>Nome</th>
<th>Competencia</th>
<th>Valor Devido</th>
</tr>
<tr>
<td>'.$v->nosso_numero.'</td>
<td>'.$v->ocorrencia.'</td>
<td>'.$v->vlr_boleto.'</td>
<td>'.$v->matricula.'</td>
<td>'.$v->nome.'</td>
<td>'.$v->competencia.'</td>
<td>'.$v->valor_devido.'</td>
</tr>
</table>
</body>
</html>
';
}
$this->mpdf->WriteHTML($html);
$this->mpdf->Output();
For each foreach element you override the value of
$htmlso it just feels like the last.– rray