j'essaie de créer un tableau en pdf ce tableau devrais avoir plusieurs lignes avec mes données récupéré dans ma base de donnée mysql mais il ne m'affiche qu'une seul ligne voici mon script ci dessous
<?php
include "".$_SERVER['DOCUMENT_ROOT']."/admin/include/mysql_connect.php";
$debut_periode = $_POST['periode'];
$debut_periode2 = strftime("%d/%m/%Y",strtotime($debut_periode));
$fin_periode = date ( 'Y-m-d' , mktime ( 0,0,0, substr( $debut_periode , 5 , 2 ) +1 ,substr( $debut_periode , 8 , 2 ) -1 ,substr( $debut_periode , 0 , 4 )));
$fin_periode2 = strftime("%d/%m/%Y",strtotime($fin_periode));
//$sql2 = "SELECT montant,description,type FROM paiement WHERE date>='$debut_periode' AND date<='$fin_periode' ORDER BY date DESC";
include("phpToPDF.php");
$PDF=new phpToPDF();
$PDF->AddPage();
$PDF->SetTextColor(0, 0, 0);
$PDF->SetFont('Arial','B',8);
$PDF->Write(4, "INFONET CREATION\n\n");
$PDF->SetFont('Arial','B',13);
$PDF->Write(4, "Chiffre d'affaire pour la période du ".$debut_periode2." au ".$fin_periode2." (en Euros)\n\n");
// Définition des propriétés du tableau.
$proprietesTableauA = array(
'TB_ALIGN' => 'R',
'L_MARGIN' => 1,
'BRD_COLOR' => array(0,0,0),
'BRD_SIZE' => '0.2',
);
// Définition des propriétés du header du tableau.
$proprieteHeaderA = array(
'T_COLOR' => array(0,0,0),
'T_SIZE' => 8,
'T_FONT' => 'Arial',
'T_ALIGN' => 'C',
'V_ALIGN' => 'M',
'T_TYPE' => 'B',
'LN_SIZE' => 5,
'BG_COLOR' => array(255, 255, 255),
'BRD_COLOR' => array(0,0,0),
'BRD_SIZE' => 0.2,
'BRD_TYPE' => '1',
'BRD_TYPE_NEW_PAGE' => '',
);
// Définition des propriétés du header du tableau.
$proprieteHeaderB = array(
'T_COLOR' => array(0,0,0),
'T_SIZE' => 8,
'T_FONT' => 'Arial',
'T_ALIGN' => 'C',
'V_ALIGN' => 'M',
'T_TYPE' => 'B',
'LN_SIZE' => 5,
'BG_COLOR' => array(216, 228, 232),
'BRD_COLOR' => array(0,0,0),
'BRD_SIZE' => 0.2,
'BRD_TYPE' => '1',
'BRD_TYPE_NEW_PAGE' => '',
);
// Contenu du header du tableau.
$contenuHeaderA = array(25, 25, 65, 25, 25, 25, "[CB]Date écriture", "[CB]N° de pièce", "[CB]Libellé de l'écriture", "[CB]Montant débit", "[CB]Mintant crédit", "[CB]Solde cumulé");
// Définition des propriétés du reste du contenu du tableau.
$proprieteContenuA = array(
'T_COLOR' => array(0,0,0),
'T_SIZE' => 8,
'T_FONT' => 'Arial',
'T_ALIGN_COL0' => 'C',
'T_ALIGN' => 'C',
'V_ALIGN' => 'M',
'T_TYPE' => '',
'LN_SIZE' => 5,
'BG_COLOR' => array(255, 255, 255),
'BRD_COLOR' => array(0,0,0),
'BRD_SIZE' => 0.1,
'BRD_TYPE' => '1',
'BRD_TYPE_NEW_PAGE' => '',
);
$sql2 = "SELECT DATE_FORMAT(date,'%d/%m/%Y') as date,num_paie,description,type,id FROM paiement WHERE date>='".$debut_periode."' AND date<='".$fin_periode."'";
$req2 = mysql_query($sql2) or die('Erreur SQL !<br>'.$sql2.'<br>'.mysql_error());
$i = 1;
$debut_solde = 0;
while($data2 = mysql_fetch_array($req2))
{
$sql10 = mysql_query("SELECT montant FROM paiement WHERE id='".$data2['id']."'") or die (mysql_error());
list($montant) = mysql_fetch_row($sql10);
if ($data2['type']=='credit')
{
$credit_aff = "".sprintf('%.2f', $montant)."";
$debit_aff = '0.00';
}
if ($data2['type']=='debit')
{
$debit_aff = "".sprintf('%.2f', $montant)."";
$credit_aff = '0.00';
}
$solde = $debut_solde+$credit_aff-$debit_aff;
if ($montant=='')
{
$tarif = '0.00';
}
else
{
$tarif = "".sprintf('%.2f', $montant)."";
}
$tarif_nul = "0.00";
if ($i<10)
{
$aff_id = "000".$i."";
}
elseif ($i>=10 AND $i<100)
{
$aff_id = "00".$i."";
}
$contenuTableauA1 = "".$data2['date']."\n";
$contenuTableauA2 = "".$data2['num_paie']."\n";
$contenuTableauA3 = "[L]".$data2['description']."\n";
$contenuTableauA4 = "[R]".$debit_aff."\n";
$contenuTableauA5 = "[R]".$credit_aff."\n";
$contenuTableauA6 = "[R]".sprintf('%.2f', $solde)."\n";
$i++;
$debut_solde = $solde;
$contenuA = array($contenuTableauA1,$contenuTableauA2,$contenuTableauA3,$contenuTableauA4,$contenuTableauA5,$contenuTableauA6);
}
$PDF->drawTableau($PDF, $proprietesTableauA, $proprieteHeaderB, $contenuHeaderA, $proprieteContenuA, $contenuA);
$sql20 = mysql_query("SELECT SUM(montant) FROM paiement WHERE type='debit' AND date>='".$debut_periode."' AND date<='".$fin_periode."'") or die (mysql_error());
list($total_debit) = mysql_fetch_row($sql20);
$sql30 = mysql_query("SELECT SUM(montant) FROM paiement WHERE type='credit' AND date>='".$debut_periode."' AND date<='".$fin_periode."'") or die (mysql_error());
list($total_credit) = mysql_fetch_row($sql30);
$total_cumule = $total_credit-$total_debit;
// Contenu du header du tableau.
$contenuHeaderB = array(25, 25, 25, "[CB]Total débit", "[CB]Total crédit", "[CB]Total cumulé");
$contenuB = array("[R]".sprintf('%.2f', $total_debit)."", "[R]".sprintf('%.2f', $total_credit)."", "[R]".sprintf('%.2f', $total_cumule)."");
$PDF->drawTableau($PDF, $proprietesTableauA, $proprieteHeaderB, $contenuHeaderB, $proprieteContenuA, $contenuB);
$PDF->Output();
?>