Generé un archivo php que llama a la clase ezpdf y me genera un PDF con dicho listado, el problema es que yo quisiera generar el pdf con la informacion de cada usuario individualmente.
Mi idea era que en el litado
Pepe /Garcia Garcia /telefono patatin patatan /email patatin patatan/ Generar pdf
Al clickear en generar pdf me montara el pdf con la información de ese usuario y asi sucesivamente de forma automática con cada uno, sin tener que hacer 200 archivos php llamando a cada usuario.
Así es como se genera mi pdf
Código PHP:
<?php
// test the table functions
error_reporting(E_ALL);
include('class.ezpdf.php');
$pdf =& new Cezpdf();
$pdf->selectFont('./fonts/Helvetica');
//--------------------------------------------------
// you will have to change these to your settings
$host = 'localhost';
$user = 'root';
$password = '';
$database = 'bd_contactos';
$query = 'select cod_nme,cod_aplds,txt_tlfno_trbllo from persoas';
//--------------------------------------------------
// open the connection to the db server
$link = mysql_connect($host,$user,$password);
// change to the right database
mysql_select_db($database);
// initialize the array
$data = array();
// do the SQL query
$result = mysql_query($query);
// step through the result set, populating the array, note that this could also have been written:
// while($data[] = mysql_fetch_assoc($result)) {}
while($data[] = mysql_fetch_array($result, MYSQL_ASSOC)) {}
// make the table
$pdf->ezTable($data);
// do the output, this is my standard testing output code, adding ?d=1
// to the url puts the pdf code to the screen in raw form, good for checking
// for parse errors before you actually try to generate the pdf file.
if (isset($d) && $d){
$pdfcode = $pdf->output(1);
$pdfcode = str_replace("\n","\n<br>",htmlspecialchars($pdfcode));
echo '<html><body>';
echo trim($pdfcode);
echo '</body></html>';
} else {
$pdf->stream();
}
?>