par
amonite » 20 févr. 2012, 17:41
Bonjour, j'ai fais ce bout de code pour ne pas afficher un titre lorsque le champ est vide, mais j'ai un soucis, si je mets les requetes au dessus, il me fais des bugs d'affichages.
Si quelqu'un sait comment remplacer cette commande, ou la faire fonctionner, je suis preneur.
Merci d'avance.
Bonne journée
<table align="center">
<tr><td><center><font size="48px" style="font-family:Vijaya; font-size:100px"><?php if (tep_not_null ($data['nom_pct'])) {echo 'Le porcelet';} ?></font></center></td></tr>
<td><img src="../images/porc.gif" width="400px" /></td>
</tr></table>
<?php
$sql = 'SELECT * FROM porcelet ORDER BY nom_pct ';
// on envoie la requête
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
?>
<table width="100%"><tr><td>
<?php
$req = mysql_query($sql); // exécution de la requête
// Nota : on pourrait tout aussi bien parcourir les éléments d'un tableau ou les fichiers d'un dossier
while ($data = mysql_fetch_assoc($req)) { // parcours des résultats
// début d'une ligne
?>
<table class="bgcolor a" ><tr><td>
<table border="0" width="100%">
<tr>
<td width="550px" height="30px"><?php echo htmlentities($data['nom_pct']); ?></td>
<td width="150px"><?php echo htmlentities($data['prix_pct']).' € <tr>'; ?></td>
</tr>
</table>
<table width="100%">
<tr>
<td width="700px"><?php echo htmlentities($data['comm_pct']); ?></td>
</tr>
</table>
</td></tr></table>
<table border="0" width="100%" class="bord">
<tr>
<td height="1px"></td>
</tr>
</table>
<?php
}
?>
</table>
Bonjour, j'ai fais ce bout de code pour ne pas afficher un titre lorsque le champ est vide, mais j'ai un soucis, si je mets les requetes au dessus, il me fais des bugs d'affichages.
Si quelqu'un sait comment remplacer cette commande, ou la faire fonctionner, je suis preneur.
Merci d'avance.
Bonne journée
[php]
<table align="center">
<tr><td><center><font size="48px" style="font-family:Vijaya; font-size:100px"><?php if (tep_not_null ($data['nom_pct'])) {echo 'Le porcelet';} ?></font></center></td></tr>
<td><img src="../images/porc.gif" width="400px" /></td>
</tr></table>
<?php
$sql = 'SELECT * FROM porcelet ORDER BY nom_pct ';
// on envoie la requête
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
?>
<table width="100%"><tr><td>
<?php
$req = mysql_query($sql); // exécution de la requête
// Nota : on pourrait tout aussi bien parcourir les éléments d'un tableau ou les fichiers d'un dossier
while ($data = mysql_fetch_assoc($req)) { // parcours des résultats
// début d'une ligne
?>
<table class="bgcolor a" ><tr><td>
<table border="0" width="100%">
<tr>
<td width="550px" height="30px"><?php echo htmlentities($data['nom_pct']); ?></td>
<td width="150px"><?php echo htmlentities($data['prix_pct']).' € <tr>'; ?></td>
</tr>
</table>
<table width="100%">
<tr>
<td width="700px"><?php echo htmlentities($data['comm_pct']); ?></td>
</tr>
</table>
</td></tr></table>
<table border="0" width="100%" class="bord">
<tr>
<td height="1px"></td>
</tr>
</table>
<?php
}
?>
</table>
[/php]