[PDF] Probleme resultat dompdf
Salut à tous,
J'ai télécharger la lib DOMPDF pour générer des documents pdf à partir de ma base mysql. Lorsque j'exécute ma page php, ça m'affiche qu'un seul résultat de ma table, en l'occurence la dernière valeur. Je voudrais que ça m'affiche tout.
Je ne vois pas ce qui cloche dans mon code php 8O.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
<?php
require_once "config.php";
require_once("../dompdf_config.inc.php");
$sql="SELECT nom, prenom FROM personne";
$result=mysql_query($sql) or die(mysql_error());
while($rows = mysql_fetch_assoc($result)){
$datatitle = $rows['nom'];
$datadesc = $rows['prenom'];
$strHtml = '<html><head><title>test</title></head><body>';
$strHtml = '<table>';
$strHtml .= '<tr>';
$strHtml .= '<td>'.$datatitle.'</td>';
$strHtml .= '<td>'.$datadesc.'</td>';
}
$strHtml .= '</table>';
$strHtml .= '</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($strHtml);
$dompdf->render();
$dompdf->stream("brochure.pdf", array("Attachment" => 0)); // switch Attachment to 1 to view PDF in Acrobat.
?> |