Fermer2
Julien30580Le 26/08/2013 à 14:45
Bonjour,
J'ai parcouru le forum mais je n'ai pas toruver de cas similaire.
Voilà ma problématique.
Je doit générer un catalogue de plusieurs pages... Et chaque pages doit afficher 2 produits provenant d'une base de données SQL
Actuellement j'arrive à générer le catalogue PDF avec 1 page par produit.

Votre aide me serait trés précieuse, MERCI

Voici mon code actuel : via une include


<?php


$db = mysql_connect('localhost', 'root', '');
mysql_select_db('***',$db);
$sql = "SELECT * FROM produit WHERE active='1' ORDER BY sousouscategorie ASC ";
$req=mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
// on affiche les informations de l'enregistrement en cours
$id=$data['id'];
$nom=$data['nom'];
$plan=$data['plan'];
$categorie=$data['sousouscategorie'];
$categorie = mb_strtoupper($categorie, 'UTF-8');
?>
<style type="text/css">

table.page_header {width: 100%; border: none; background-color: #e1e1e1; border-bottom: solid 1mm #bcbcbc; padding: 2mm }
table.page_footer {width: 100%; border: none; background-color: #e1e1e1; border-top: solid 1mm #bcbcbc; padding: 2mm}
h3.note {border: solid 1mm #DDDDDD;background-color: #EEEEEE; padding: 2mm; border-radius: 2mm; width: 100%; }
ul.main { width: 95%; list-style-type: square; }
ul.main li { padding-bottom: 2mm; }
h1 {text-align: center; font-size: 20mm}
h3 {text-align: center; font-size: 12mm}
h5 {letter-spacing: 10px; text-align: center; font-size: 8mm}

</style>

<page backtop="20mm" backbottom="0mm" backleft="10mm" backright="10mm" style="font-size: 12pt">
<page_header>
<table class="page_header">
<tr>
<td style="width: 100%; text-align: center">
<h5><?php


echo preg_replace("/(.{1})/Ui", "$1&nbsp;", $categorie);?></h5>

</td>

</tr>
</table>
</page_header>
<page_footer>
<table class="page_footer">
<tr>
<td style="width: 33%; text-align: left;">
url
</td>
<td style="width: 34%; text-align: center">
page [[page_cu]] / [[page_nb]]
</td>
<td style="width: 33%; text-align: right">
&copy; CP France 2013 </td>
</tr>
</table>
</page_footer>
<br><br><table>
<tr><td><h3 class="note">&nbsp;<?php echo $id ;?>&nbsp;</h3></td></tr>
</table><br><br><br>

<table style="border-collapse:collapse;"border="1" align="center" width="100%">
<tr>
<td height=250 width=350 align="center">
<?php echo "<img width=\"200\" height=\"200\" src=\"imageProduits/$id.jpg\">"; ?>

</td>
<?php if (!empty($plan))
{
echo "<td height=250 width=350 align=\"center\"><img width=\"200\" height=\"200\" src=\"imageProduits/$id-zoom.jpg\"></td>";
}
?>
</tr>
</table>
<table width=100%>
<tr>
<td><h4><?php $Nom=str_replace ("***","Réf :","$nom"); echo $Nom; ?></h4></td>
</tr>
</table>
</page>
<?php
}
?>