IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bibliothèques et frameworks PHP Discussion :

[FPDF] drawTableau et boucle while


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    43
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 43
    Points : 24
    Points
    24
    Par défaut [FPDF] drawTableau et boucle while
    Bonjour,

    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

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
     
    <?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();
     
    ?>

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Pluot comme ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    $contenuA[] = array($contenuTableauA1,$contenuTableauA2,$contenuTableauA3,$contenuTableauA4,$contenuTableauA5,$contenuTableauA6);

  3. #3
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    43
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 43
    Points : 24
    Points
    24
    Par défaut
    ça fonctionne toujours pas voici l'erreur:

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 1347

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 1347

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 1347

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 1347

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 1347

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 1347

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 901

    Notice: Undefined index: 08/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: REGL00001 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [L]Réinstallation du système in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]75.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 901

    Notice: Undefined index: 10/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: REGL00002 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [L]Assistance à domicile in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]30.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 901

    Notice: Undefined index: 13/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: REGL00003 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [L]Réinstallation complète du système in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]75.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 901

    Notice: Undefined index: 13/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: PREL00001 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [L]Carte Réseau PCI 10/100 Base T in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]10.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 901

    Notice: Undefined index: 13/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: REGL00003 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [L]Remplacement carte réseau in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]10.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 901

    Notice: Undefined index: 13/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: REGL00003 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [L]Carte réseau PCI 10/100 Base T in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Undefined index: [R]10.00 in C:\EasyPHP 2.0b1\www\admin\CA\phpToPDF.php on line 923

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 709

    Notice: Undefined index: 08/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: REGL00001 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [L]Réinstallation du système in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]75.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 810

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 709

    Notice: Undefined index: 10/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: REGL00002 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [L]Assistance à domicile in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]30.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 810

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 709

    Notice: Undefined index: 13/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: REGL00003 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [L]Réinstallation complète du système in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]75.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 810

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 709

    Notice: Undefined index: 13/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: PREL00001 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [L]Carte Réseau PCI 10/100 Base T in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]10.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 810

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 709

    Notice: Undefined index: 13/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: REGL00003 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [L]Remplacement carte réseau in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]10.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 810

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 709

    Notice: Undefined index: 13/08/2005 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: REGL00003 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [L]Carte réseau PCI 10/100 Base T in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]0.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Undefined index: [R]10.00 in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 766

    Notice: Array to string conversion in C:\EasyPHP 2.0b1\www\admin\CA\fpdf.php on line 810
    FPDF error: Some data has already been output, can't send PDF file

  4. #4
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Tu as bien juste changé la ligne que j'ai indiqué ?
    Si tu fais un après ta boucle tu obtiens quoi ?

    Au passage, a quoi sert $sql10 ? pourquoi tu ne recupères pas le montant dans $sql2 ?

  5. #5
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    43
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 43
    Points : 24
    Points
    24
    Par défaut
    oui j'ai bien changé uniquement la ligne que tu m'as indiqué

    alres le print_r j'obtient:



    Array ( [0] => Array ( [0] => 08/08/2005 [1] => REGL00001 [2] => [L]Réinstallation du système [3] => [R]0.00 [4] => [R]75.00 [5] => [R]75.00 ) [1] => Array ( [0] => 10/08/2005 [1] => REGL00002 [2] => [L]Assistance à domicile [3] => [R]0.00 [4] => [R]30.00 [5] => [R]105.00 ) [2] => Array ( [0] => 13/08/2005 [1] => REGL00003 [2] => [L]Réinstallation complète du système [3] => [R]0.00 [4] => [R]75.00 [5] => [R]180.00 ) [3] => Array ( [0] => 13/08/2005 [1] => PREL00001 [2] => [L]Carte Réseau PCI 10/100 Base T [3] => [R]10.00 [4] => [R]0.00 [5] => [R]170.00 ) [4] => Array ( [0] => 13/08/2005 [1] => REGL00003 [2] => [L]Remplacement carte réseau [3] => [R]0.00 [4] => [R]10.00 [5] => [R]180.00 ) [5] => Array ( [0] => 13/08/2005 [1] => REGL00003 [2] => [L]Carte réseau PCI 10/100 Base T [3] => [R]0.00 [4] => [R]10.00 [5] => [R]190.00 ) )

  6. #6
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Ah zut j'avais mal lu, les champs doivent se suivrent :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    $contenuA[] = $data2['date'];
    $contenuA[] = $data2['num_paie'];
    $contenuA[] = "[L]".$data2['description'];
    $contenuA[] = "[R]".$debit_aff;
    $contenuA[] = "[R]".$credit_aff;
    $contenuA[] = "[R]".sprintf('%.2f', $solde);
    $i++;
    $debut_solde = $solde;
     
    }
    et tout au début du code pour que ce soit plus propre :

  7. #7
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    43
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 43
    Points : 24
    Points
    24
    Par défaut
    j'ai modifié ma boucle while voir copie ci-dessous

    mon pdf s'affiche mais toujours une seul ligne dans le pdf


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
     
    while($data2 = mysql_fetch_array($req2)) 
    {
    $contenuA = array();
     
    $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."";
    }
    $contenuA[] = $data2['date'];
    $contenuA[] = $data2['num_paie'];
    $contenuA[] = "[L]".$data2['description'];
    $contenuA[] = "[R]".$debit_aff;
    $contenuA[] = "[R]".$credit_aff;
    $contenuA[] = "[R]".sprintf('%.2f', $solde);
    $i++;
    $debut_solde = $solde;
     
     
    //$contenuA[] = array();
     
    }

  8. #8
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Tout au début du code, pas au début de la boucle.

    Au passage, a quoi sert $sql10 ? pourquoi tu ne recupères pas le montant dans $sql2 ?

Discussions similaires

  1. [FPDF] Boucle while avec FPDF renvoie une page blanche
    Par jmtrivia dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 28/06/2018, 09h54
  2. [FPDF] drawTableau et boucle while
    Par cédric20 dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 13/06/2011, 13h03
  3. [FPDF] Boucle while éléments se superpose
    Par lgm243 dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 30/03/2010, 16h07
  4. [FPDF] Boucle while et saut de page
    Par sylvy dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 21/10/2008, 15h27
  5. [débutant]Documentation? boucle "while"? Session?
    Par o151181 dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 19/01/2004, 15h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo