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 30 31 32 33 34 35 36 37
| <?php
require('fpdf.php');
$pdf=new FPDF('P','cm','A4');
$header=array('Nom Site','Fourniture raccordement','Débit Nominal');
$pdf->SetFont('Arial','B',14);
$pdf->AddPage();
$pdf->SetFillColor(96,96,96);
$pdf->SetTextColor(255,255,255);
mysql_connect('localhost','root','') or die("ERROR DATABASE CONNECTION");
mysql_select_db('daher') or die("DATA SELECTION ERRROR");
$query="SELECT * FROM referentiel_mpls_daher";
$resultat=mysql_query($query);
$pdf->SetXY(3,3);
for($i=0;$i<sizeof($header);$i++)
$pdf->cell(5,1,$header[$i],1,0,'C',1);
$pdf->SetFillColor(0xdd,0xdd,0xdd);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',10);
$pdf->SetXY(3,$pdf->GetY()+1);
$fond=0;
while($row=mysql_fetch_array($resultat))
{
$pdf->cell(5,0.7,$row['nom_site'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['fourniture_raccordement'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['debit_nominal'],1,0,'C',$fond);
$pdf->SetXY(3,$pdf->GetY()+0.7);
$fond=!$fond;
}
$pdf->output();
?> |