I'm developing a dynamic report with mPDF, but I'm not able to put my data inside a variable so I can output it.
My page is designed like this:
$html = '<div class="box-content no-padding table-responsive relMembros">'
.'<table class="table table-bordered table-striped table-hover table-heading table-datatable" id="tabMembros">'
.' <thead>'
.' <tr>'
.' <th>Nome</th>'
.' <th>Telefone</th>'
.' <th>Aniversario</th>'
.' <th>Email</th>'
.' <th>Úsuario mobile</th>'
.' <th>Status</th>'
.' </tr>'
.' </thead>'
.' <tbody>';
$conexao = new ConexaoDatabase();
$sql = "MINHA QUERY";
$sqlVars = array();
$sqlVars[':igj'] = $suc->getCOD_IDENT_IGREJ();
$registros = $conexao->fetchAll($sql, $sqlVars);
if ($registros) {
foreach ($registros as $registro) {
echo '<tr>'
. '<td>' . $registro->TXT_NOMEX_PESSO . '</td>'
. '<td>' . $registro->TXT_FONEX_PESSO . '</td>'
. '<td>' . $registro->DAT_NASCI_PESSO . '</td>'
. '<td>' . $registro->TXT_EMAIL_PESSO . '</td>'
. '<td>' . $registro->FLG_USUAR_MOBIL . '</td>'
. '<td>' . $registro->FLG_STATU_PESSO . '</td>'
. '</tr>';
}
} else {
//echo 'Não existe vinculo para está pessoa.';
}
$html = $html . '</tbody>'
.'</table>'
.'</div>';
include("../pdf/mpdf60/mpdf.php");
$mpdf=new mPDF();
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);
$mpdf->list_number_suffix = ')';
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
?>
To open this page I'm using AJAX to load the core of my index.