Affichage sous pdf

Fermé
zeghad Messages postés 67 Date d'inscription mardi 20 mai 2014 Statut Membre Dernière intervention 7 mars 2017 - 9 oct. 2014 à 12:11
zeghad Messages postés 67 Date d'inscription mardi 20 mai 2014 Statut Membre Dernière intervention 7 mars 2017 - 9 oct. 2014 à 14:10
Bonjour, j aimerais bien vous m aidez pour trouver l'erreur dans cet code sachant que je veux imprimer des résultats sous pdf(j utilise une boucle while)
<?php
$html = '<style type="text/css">
<!--
select { width: 150px; }
option { width: 300px; }
-->
</style>
</head>
<body>
<!--contenu de code-->	
<div id="container">
<!--*****************************************partie entete **********************************************-->		


	

   

<div class="suiviM">'


$choix;
$somme1=0;
$somme2=0;
$somme3=0;
$somme4=0;
$somme5=0;
$s1=0;
$s2=0;
$s3=0;
$s4=0;
$s5=0;
//pour calculer la so;;e totale de la section a revenir
include("conexion.php");
//________________selectionner les chapitre de la preiere section________________________________________________________//
$req=mysql_query("SELECT * FROM chapitre where IDsec='1' ")or die(mysql_error());
    while($donnee=mysql_fetch_array($req)) 
                 {
                  $choix= $donnee['nomchap'];
             '<h1 dir="rtl"> ????? ????? </h1>
                  <h2 dir="rtl"><?php echo $choix; ?></h2> 
                  <table width="800px" border="2px" bgcolor="#FFF">
                 <tr>
                  <td width="100px" align="center">%</td>
                  <td width="100px" align="center">??????</td>
                  <td width="100px" align="center">?????</td>
                  <td width="100px" align="center">??????</td>
                  <td width="100px" align="center">??????? ???????</td>
                  <td width="100px" align="center">??????? ????????</td>
                  <td width="100px" align="center">?????? ????? ? ?????</td>
                  <td width="100px" align="center">?????</td>
                </tr>'
              
   $reqet=mysql_query("SELECT * FROM article where IDsec='1' and nomchap='$choix' order by numart asc ")or die(mysql_error());
                    while($donnee=mysql_fetch_array($reqet)) 
                 {
                  $numart=$donnee['numart'];
                  $description=$donnee['descriptionart'];
                  $budgi=$donnee['budgetd'];
                  $budgs=$donnee['budgets'];
                  $enga=$donnee['engagementart'];
                  $verss=$donnee['versementart'];
                  $rest=$donnee['restart'];
                  $pourcentage=$donnee['pourcentageart']; 
                  
               '<tr>
                  <td width="100px" align="center">'. echo $pourcentage;.'</td>
                  <td width="100px" align="center">'. echo $rest; .'</td>
                  <td width="100px" align="center">'. echo $verss;.'</td>
                  <td width="100px" align="center">'. echo $enga; .'</td>
                  <td width="100px" align="center">'. echo $budgs; .'</td>
                  <td width="100px" align="center">'. echo $budgi; .'</td>
                  <td width="100px" align="center">'. echo $description;.'</td>
                  <td width="100px" align="center">'. echo $numart ;.' </td>
                </tr>'
                 }

               

               $sp; 
               $sv;
               $sr;
               $sen; 
               $bs;
               $bi;
$query=mysql_query("select sum(pourcentageart) AS sp FROM article  where IDsec='1' and nomchap='$choix' ")or die(mysql_error());
$result = mysql_fetch_assoc($query);

$query1=mysql_query("select sum(versementart) AS sv FROM article  where IDsec='1' and nomchap='$choix' ")or die(mysql_error());
$result1 = mysql_fetch_assoc($query1);
$somme1=$somme1+$result1['sv'];


$query2=mysql_query("select sum(restart) AS sr FROM article  where IDsec='1' and nomchap='$choix' ")or die(mysql_error());
$result2 = mysql_fetch_assoc($query2);
$somme2=$somme2+$result2['sr'];


$query3=mysql_query("select sum(engagementart) AS sen FROM article  where IDsec='1' and nomchap='$choix' ")or die(mysql_error());
$result3 = mysql_fetch_assoc($query3);
$somme3=$somme3+$result3['sen'];


$query4=mysql_query("select sum(budgets) AS bs FROM article  where IDsec='1' and nomchap='$choix' ")or die(mysql_error());
$result4 = mysql_fetch_assoc($query4);
$somme4=$somme4+$result4['bs'];


$query5=mysql_query("select sum(budgetd) AS bi FROM article  where IDsec='1' and nomchap='$choix' ")or die(mysql_error());
$result5= mysql_fetch_assoc($query5);
$somme5=$somme5+$result5['bi'];
           
              

                '<tr>
                 <td width="100px"  align="center">'. echo $result['sp']; .'</td>
                  <td width="100px" align="center">'. echo $result2['sr'];.'</td>
                  <td width="100px" align="center">'. echo $result1['sv'];.' </td>
                  <td width="100px" align="center">'. echo $result3['sen'];.' </td>
                  <td width="100px" align="center">'. echo $result4['bs'];.' </td>
                  <td width="100px" align="center">'.echo $result5['bi'];.' </td>
                  <td width="100px" align="center">'.echo "????? ?????"; .'</td>
                  <td width="100px" align="center"></td>
                </tr>
                 <tr>
                 <td width="100px" ></td>
                  <td width="100px" align="center">'. echo $somme2; .'</td>
                  <td width="100px" align="center">'. echo $somme1;.'</td>
                  <td width="100px" align="center">'. echo $somme3; .'</td>
                  <td width="100px" align="center">'. echo $somme4;.'</td>
                  <td width="100px" align="center">'.echo $somme5;.'</td>
                  <td width="100px" align="center">'. echo "????? ????";.'</td>
                  <td width="100px" align="center"></td>
                </tr>
                 </table>

                  '
                 }
                 
 //________________selectionner les chapitre de la 2eme section________________________________________________________// 
$som1=0;
$som2=0;
$som3=0;
$som4=0;
$som5=0; 
 $req=mysql_query("SELECT * FROM chapitre where IDsec='2' ")or die(mysql_error());
    while($donnee=mysql_fetch_array($req)) 
                 {
                  $choix= $donnee['nomchap'];
                ' <h1 dir="rtl"> ????? ?????? </h1>
                  <h2 dir="rtl"><?php echo $choix; ?></h2> 
                  <table width="800px" border="2px" bgcolor="#FFF">
                 <tr>
                  <td width="100px" align="center">%</td>
                  <td width="100px" align="center">??????</td>
                  <td width="100px" align="center">?????</td>
                  <td width="100px" align="center">??????</td>
                  <td width="100px" align="center">??????? ???????</td>
                  <td width="100px" align="center">??????? ????????</td>
                  <td width="100px" align="center">?????? ????? ? ?????</td>
                  <td width="100px" align="center">?????</td>
                </tr>'
              
   $reqet=mysql_query("SELECT * FROM article where IDsec='2' and nomchap='$choix' order by numart asc ")or die(mysql_error());
                    while($donnee=mysql_fetch_array($reqet)) 
                 {
                  $numart=$donnee['numart'];
                  $description=$donnee['descriptionart'];
                  $budgi=$donnee['budgetd'];
                  $budgs=$donnee['budgets'];
                  $enga=$donnee['engagementart'];
                  $verss=$donnee['versementart'];
                  $rest=$donnee['restart'];
                  $pourcentage=$donnee['pourcentageart']; 
                  '<tr>
                  <td width="100px" align="center">'. echo $pourcentage; .'</td>
                  <td width="100px" align="center">'. echo $rest; .'</td>
                  <td width="100px" align="center">'. echo $verss; .'</td>
                  <td width="100px" align="center">'. echo $enga; .'</td>
                  <td width="100px" align="center">'. echo  $budgs ; .'</td>
                  <td width="100px" align="center">'. echo $budgi;.'</td>
                  <td width="100px" align="center">'. echo $description;.'</td>
                  <td width="100px" align="center">'. echo $numart ; .'</td>
                </tr>'
                 }
               $sp; 
               $sv;
               $sr;
               $sen; 
               $bs;
               $bi;
$query=mysql_query("select sum(pourcentageart) AS sp FROM article  where IDsec='2' and nomchap='$choix' ")or die(mysql_error());
$result = mysql_fetch_assoc($query);

$query1=mysql_query("select sum(versementart) AS sv FROM article  where IDsec='2' and nomchap='$choix' ")or die(mysql_error());
$result1 = mysql_fetch_assoc($query1);
$som1=$som1+$result1['sv'];


$query2=mysql_query("select sum(restart) AS sr FROM article  where IDsec='2' and nomchap='$choix' ")or die(mysql_error());
$result2 = mysql_fetch_assoc($query2);
$som2=$som2+$result2['sr'];


$query3=mysql_query("select sum(engagementart) AS sen FROM article  where IDsec='2' and nomchap='$choix' ")or die(mysql_error());
$result3 = mysql_fetch_assoc($query3);
$som3=$som3+$result3['sen'];


$query4=mysql_query("select sum(budgets) AS bs FROM article  where IDsec='2' and nomchap='$choix' ")or die(mysql_error());
$result4 = mysql_fetch_assoc($query4);
$som4=$som4+$result4['bs'];


$query5=mysql_query("select sum(budgetd) AS bi FROM article  where IDsec='2' and nomchap='$choix' ")or die(mysql_error());
$result5= mysql_fetch_assoc($query5);
$som5=$som5+$result5['bi'];
             
              

                 '<tr>
                 <td width="100px" align="center">'. echo $result['sp'];.'</td>
                  <td width="100px" align="center">'. echo $result2['sr'];.'</td>
                  <td width="100px" align="center">'. echo $result1['sv'];.'</td>
                  <td width="100px" align="center">'. echo $result3['sen'];.'</td>
                  <td width="100px" align="center">'. echo $result4['bs'];.'</td>
                  <td width="100px" align="center">'. echo $result5['bi'];.'</td>
                  <td width="100px" align="center">'. echo "????? ?????";.'</td>
                  <td width="100px"></td>
                </tr>
                 
                 <tr>
                 <td width="100px" align="center" ></td>
                  <td width="100px" align="center">'. echo $som2;.'</td>
                  <td width="100px" align="center">'. echo $som1;.'</td>
                  <td width="100px" align="center">'. echo $som3;.'</td>
                  <td width="100px" align="center">'. echo $som4;.'</td>
                  <td width="100px" align="center">'. echo $som5;.'</td>
                  <td width="100px" align="center">'. echo "????? ????";.'</td>
                  
                </tr>
                 </table>'
                
                 }
               
         $s1=$somme1+$som1;
         $s2=$somme2+$som2; 
         $s3=$somme3+$som3;
         $s4=$somme4+$som4;
         $s5=$somme5+$som5;

'<h1 align="center">?????? ??????? ??????? ????? 2014</h1>
          <table width="800px" border="2px" bgcolor="#FFF">
                 <tr>
                  <td width="100px"  align="center">%</td>
                  <td width="100px" align="center">??????</td>
                  <td width="100px" align="center">?????</td>
                  <td width="100px" align="center">??????</td>
                  <td width="100px" align="center">??????? ???????</td>
                  <td width="100px" align="center">??????? ????????</td>
                  <td width="100px" align="center">????????</td>
                 </tr>
                 <tr>
                  <td width="100px"></td>
                  <td width="100px" align="center">'. echo $somme2;.'</td>
                  <td width="100px" align="center">'.echo $somme1;.'</td>
                  <td width="100px" align="center">'.echo $somme3;.'</td>
                  <td width="100px" align="center">'.echo $somme4;.'</td>
                  <td width="100px" align="center">'.echo $somme5;.'</td>
                  <td width="100px" align="center">????? ????? ?????</td>
                  
                </tr>
                <tr>
                  <td width="100px" ></td>
                  <td width="100px" align="center">'.echo $som2;.'</td>
                  <td width="100px" align="center">'.echo $som1;.'</td>
                  <td width="100px" align="center">'.echo $som3;.'</td>
                  <td width="100px" align="center">'.echo $som4;.'</td>
                  <td width="100px" align="center">'.echo $som5;.'</td>
                  <td width="100px" align="center">????? ????? ??????</td>
                </tr>
                <tr>
                  <td width="100px" align="center" ></td>
                  <td width="100px" align="center">'.echo $s2;.'</td>
                  <td width="100px" align="center">'.echo $s1;.'</td>
                  <td width="100px" align="center">'.echo $s3;.'</td>
                  <td width="100px" align="center">'.echo $s4;.'</td>
                  <td width="100px" align="center">'.echo $s5;.'</td>
                  <td width="100px" align="center">???????</td>
                </tr>
         </table>       
</div>
</div>

</body>'

include("MPDF/mpdf.php");


$mpdf=new mPDF('','A4','','utf8',32,25,27,25,16,13); 

$mpdf->SetDirectionality('rtl');
$mpdf->mirrorMargins = true;
$mpdf->SetDisplayMode('fullpage','two');

$mpdf->autoLangToFont = true;

$mpdf->defaultPageNumStyle = 'arabic-indic';


$mpdf->debug = true;

$mpdf->WriteHTML($html);

$mpdf->Output();
exit;
?>
A voir également:

2 réponses

zeghad Messages postés 67 Date d'inscription mardi 20 mai 2014 Statut Membre Dernière intervention 7 mars 2017 1
9 oct. 2014 à 14:07
mrc de m avoir répondre
mon probleme est :l affichage du resultat sous un fichier pdf et non pas le tri
j utilise mfpdf
0
zeghad Messages postés 67 Date d'inscription mardi 20 mai 2014 Statut Membre Dernière intervention 7 mars 2017 1
9 oct. 2014 à 14:10
de mm g utilise groupe by mais elle m affiche pas tous les element dépendants du critère de la selection.
SELECT *
FROM article
GROUP BY nomchap
lors de l affichage;elle affiche seulement le premier element c est pour ca j ai utiliser une boucle
0