Codice PHP:
<?php
require('fpdf/fpdf.php');
class PDF_classe extends FPDF
{
function Row($data)
{
$this->SetFillColor(232,232,232);
$this->SetFont('Arial','',8);
//Numero
$this->SetY(2);
$this->Cell(50,0,'Numero Protocollo',0,0,'L',0);
$this->Cell(1,0,$data[Numero],0,0,'R',0);
//Data
$this->SetY(5);
$this->Cell(0,0,'Data',0,0,'L',0);
$this->Cell(0,0,$data[data_prot],0,0,'R',0);
//Cognome
$this->SetY(8);
$this->Cell(0,0,'Cognome',0,0,'L',0);
$this->Cell(0,0,$data[Cognome],0,0,'R',0);
//Nome
$this->SetY(11);
$this->Cell(0,0,'Nome',0,0,'L',0);
$this->Cell(0,0,$data[Nome],0,0,'R',0);
//Oggetto
$this->SetY(14);
$this->Cell(0,0,'Oggetto',0,0,'L',0);
$this->Cell(0,0,$data[Oggetto],0,0,'R',0);
}
function Table($query)
{
//errore query
$res=mysql_query($query) or die('Error: '.mysql_error()."
Query: $query");
while($row=mysql_fetch_array($res))
{
$this->AddPage();
$this->Row($row);
//$this->AddPage();
}
}
}
?>