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 38 39 40
| ob_end_clean();
$pdf=new FPDF('P','cm','A4');
//Titres des colonnes
$header=array('Nom','Prenom','Sexe', 'Age', 'Ville', 'Parcours', 'Club', 'Federation', 'Licence');
$pdf->SetFont('Arial','B',8);
$pdf->AddPage();
$pdf->SetFillColor(96,96,96);
$pdf->SetTextColor(255,255,255);
$query="select nom, prenom, sexe, age, ville, parcours, club, federation, licence from preins";
$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','',8);
$pdf->SetXY(3,$pdf->GetY()+1);
$fond=0;
while($row=mysql_fetch_array($resultat))
{
$pdf->cell(2,0.7,$row['nom'],1,0,'C',$fond);
$pdf->cell(2,0.7,$row['prenom'],1,0,'C',$fond);
$pdf->cell(1,0.7,$row['sexe'],1,0,'C',$fond);
$pdf->cell(2,0.7,$row['age'],1,0,'C',$fond);
$pdf->cell(2,0.7,$row['ville'],1,0,'C',$fond);
$pdf->cell(2,0.7,$row['parcours'],1,0,'C',$fond);
$pdf->cell(2,0.7,$row['club'],1,0,'C',$fond);
$pdf->cell(2,0.7,$row['federation'],1,0,'C',$fond);
$pdf->cell(2,0.7,$row['licence'],1,0,'C',$fond);
$pdf->SetXY(3,$pdf->GetY()+0.7);
$fond=!$fond;
}
$pdf->output();
mysql_close($db); |
Partager