How to use foreach with the mPdf library?

0

Hello, friends.

I'm in a hard problem, I know what it is, but I can not solve it.

Well, I'm using the mPDF library to generate reports, it's great and very simple to use. I am bringing information from the database and saving it on a table and it is what it is to appear in the report, however it only generates the last row of this table and this is obvious, as it does not have a repeat structure (foreach I am using) consequently does not bring all the information of the bank.

My code is this:

<?php
    include("mpdf60/mpdf.php");
    require_once ('../Controller/crudComissao.php');

   $idFuncionario = $row['idFuncionario'];
   $nomeFuncionario = $row['nomeFuncionario'];
   $valor = $row['valor'];

if (isset($_POST['btImprimir'])) {
$html = "
     <fieldset>
        <div class='container'>
        <div class='text-center'>
         <img src='img/logorelatorio.png' >
        </div>
        <br>
        <h3>Comissões</h3>
         <table class='table table-hover table-bordered'>
                <thead>
                    <tr>
                        <th class='text-center'>Código</th>
                        <th class='text-center'>Nome do Corretor</th>
                        <th class='text-center'>Mês</th>
                        <th class='text-center'>Valor(R$)</th>
                    </tr>
                </thead>                   

                    <tr>
                        <td class='text-center'> $idFuncionario </td>
                        <td class='text-center'> $nomeFuncionario</td>
                        <td class='text-center'> $mes_nome </td>
                        <td class='text-center'>R$ $valor </td>
                    </tr>
                <tfoot>
                    <tr>
                        <td></td>
                        <td></td>
                        <td align='right'>Total</td>
                        <td align='center'>R$ $sum </td>
                    </tr>
                </tfoot>
                </table>
            </div>
     </fieldset>";

    $mpdf=new mPDF(); 
    $mpdf->SetDisplayMode('fullpage');
    $css = file_get_contents("css/cavalaro.css");
    $css = file_get_contents("css/bootstrap-3.3.6-dist/css/bootstrap.css");
    $mpdf->WriteHTML($css,1);
    $mpdf->WriteHTML($html);
    $mpdf->Output("comissao.pdf",'D');
}

?>

I hope it was clear. Thank you.

    
asked by anonymous 28.05.2016 / 03:18

0 answers