Buon giorno, vorrei sapere tramite lo script che posterò, come faccio ad inserire i record estrapolati all'interno di una tabella.
Lo script l'ho preso dal sito fpdf.org nella sezione tutorial 5.
codice:
require('fpdf.php');
class PDF extends FPDF{
	//Load data
	function LoadData($file){
		//Read file lines
		$lines=file($file);
		$data=array();
		foreach($lines as $line)
			$data[]=explode(';',chop($line));
		return $data;
	}

	//Simple table
	function BasicTable($header,$data){
		//Header
		foreach($header as $col)
			$this->Cell(25,7,$col,1);
		$this->Ln();
		//Data
		foreach($data as $row){
			foreach($row as $col)
				$this->Cell(25,6,$col,1);
			$this->Ln();
		}
	}
}
$pdf=new PDF();
//Column titles
$header=array('Nominativo','Indirizzo','Codice','Interno','Telefono');
//Data loading
$data=$pdf->LoadData('countries.txt');
$pdf->SetFont('Arial','',8);
$pdf->AddPage();
$pdf->BasicTable($header,$data);
Questo script funziona, però legge i valori da un txt. A me serve inserire nella tabella, i record che estrapolo dal DB, cosi:
codice:
$sqlRapp = ("select COGNOME_REC, NOME_REC, COD_IMMOBILE,INDIRIZZO_REC, INTERNO_REC,TELEFONO_REC from EMISSIONE as tab1 left join RAPP as tab2
on tab1.ID_RAPPORTO = tab2.ID_RAPPORTO
where 
tab1.ID_RAPPORTO= " . $rapp . " and
tab1.MESE_EMISS= " . $mese . " and
ta1.ANNO_EMISS= " . $anno . "") or die ("Errore esecuzione della Select Rapporto" . mysql_error());
			
$RsRapp = mysql_query($sqlRapp);

if(mysql_num_rows($RsRapp)==0){
echo "

<p class='Titolo' align='center'>La ricerca non ha prodotto risultati!</p>";
exit;
}
else{
while ($riga = mysql_fetch_array($RsRapp)) {
$COGNOME_REC = $riga['COGNOME_REC'];
$NOME_REC = $riga['NOME_REC'];
$COD_IMMOBILE = $riga['COD_IMMOBILE'];
$INDIRIZZO_REC = $riga['INDIRIZZO_REC'];
$INTERNO_REC = $riga['INTERNO_REC'];
$TELEFONO_REC = $riga['TELEFONO_REC'];
}
}
mysql_free_result($RsRapp); 
mysql_close();
Come posso fare?Mi date una mano per favore?
Grazie mille....