Bonjour,
J'ai placé une condition dans ma syntae sql afin qu'un message du type "aucun article..." apparaissent lorsqu'il n'y a aucun article dans la catégorie:
$sql = "SELECT COUNT(categorie) AS quantite FROM XXX WHERE categorie LIKE '$categorie'";
if ($quantite == "") {
echo "Aucun article dans cette catégorie";
}
Le pb c'est que le message "Aucun article dans cette catégorie" s'affiche même lorsqu'il y a un article ! ! !
Je cale, merci de m'aider !
je vous donne la suite du code:
mysql_connect("sql.free.fr","XXX","XXX");
mysql_select_db("XXX");
$categorie = $HTTP_POST_VARS['categorie'];
$sql = "SELECT * FROM XXX WHERE categorie LIKE '$categorie' ORDER BY 'id' DESC";
$result = mysql_query($sql);
while ($data = mysql_fetch_array($result)) {
echo "<div align='center'> <img src='$data[image]' border='1' width='200' height='160'></div>";
echo "<div align='center'><small><FONT COLOR= #006699><u>Référence:</font></u> $data[id] </small></div>";
echo "<FONT COLOR= #006699><b>Titre:</b></font><g> $data[titre] </g><br><FONT COLOR= #006699> <b>Description:</b> </font> $data[descriptif] <br><br> <FONT COLOR= #006699><b>Prix:</b></font> $data[prix] euro<br> <FONT COLOR= #006699><b>Frais de port:</b></font>$data[port] euro<br><br>";
echo "<FONT COLOR= #006699><b>Lieu:</b></font> $data[ville] - $data[departement]<br>";
echo "<FONT COLOR= #006699><b>Contact:</b></font>$data[mail1]<img src= images/arobase.jpg>$data[mail2]<img src= images/point.jpg>$data[mail3]<br>";
echo "<div align='right'><small><FONT COLOR= #006699><a href='abus.php'>Signaler un abus</a></div></small><br>";
// On sépare les resultats
echo '<hr size="4" align="center" width="95%" class="Style1"><br>';
}
J'ai placé une condition dans ma syntae sql afin qu'un message du type "aucun article..." apparaissent lorsqu'il n'y a aucun article dans la catégorie:
$sql = "SELECT COUNT(categorie) AS quantite FROM XXX WHERE categorie LIKE '$categorie'";
if ($quantite == "") {
echo "Aucun article dans cette catégorie";
}
Le pb c'est que le message "Aucun article dans cette catégorie" s'affiche même lorsqu'il y a un article ! ! !
Je cale, merci de m'aider !

je vous donne la suite du code:
mysql_connect("sql.free.fr","XXX","XXX");
mysql_select_db("XXX");
$categorie = $HTTP_POST_VARS['categorie'];
$sql = "SELECT * FROM XXX WHERE categorie LIKE '$categorie' ORDER BY 'id' DESC";
$result = mysql_query($sql);
while ($data = mysql_fetch_array($result)) {
echo "<div align='center'> <img src='$data[image]' border='1' width='200' height='160'></div>";
echo "<div align='center'><small><FONT COLOR= #006699><u>Référence:</font></u> $data[id] </small></div>";
echo "<FONT COLOR= #006699><b>Titre:</b></font><g> $data[titre] </g><br><FONT COLOR= #006699> <b>Description:</b> </font> $data[descriptif] <br><br> <FONT COLOR= #006699><b>Prix:</b></font> $data[prix] euro<br> <FONT COLOR= #006699><b>Frais de port:</b></font>$data[port] euro<br><br>";
echo "<FONT COLOR= #006699><b>Lieu:</b></font> $data[ville] - $data[departement]<br>";
echo "<FONT COLOR= #006699><b>Contact:</b></font>$data[mail1]<img src= images/arobase.jpg>$data[mail2]<img src= images/point.jpg>$data[mail3]<br>";
echo "<div align='right'><small><FONT COLOR= #006699><a href='abus.php'>Signaler un abus</a></div></small><br>";
// On sépare les resultats
echo '<hr size="4" align="center" width="95%" class="Style1"><br>';
}