Probleme php

tita -  
 tita -
Bonjour, je suis debutant en php et
j'ai un petit souci en php, je veux afficher les articles qui sont en promotion, et on m'affiche cet erreur là:

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\Users\tita\wamp\www\Materiels\home.php on line 87

voici le code

<?php
require_once('connexion.php');
$req="SELECT reference, designation, description, prix FROM articles WHERE promotion = 'oui'";
$res=mysql_query($req);

echo "<table width='50%'>";
echo "<tr bgcolor=#8080FF><th>Référence</th><th>Désignation</th><th>Description</th><th>Prix unitaire (euro)</th></tr>";
$l=1;
while(list($reference,$designation,$description,$prix)=mysql_fetch_object($res))
{
echo "<tr".($l % 2 ==0?" class=`impair`":"").">";
echo "<td><a href=ficheArticle.php?ref=$ref><font color=blue>".$reference."</font></a></td>";
echo "<td>".$designation."</td>";
echo "<td>".$description."</td>";
echo "<td>".$prix."</td>";
echo "</tr>";

$l++;
}
echo "</table>";
?>

aidez moi svp!!
A voir également:

3 réponses

Matthieu E.
 
Essaye ca mais je suis pas sur que ca marche avec MySql
<?php
require_once('connexion.php');
$req="SELECT reference, designation, description, prix FROM articles WHERE promotion = 'oui'";
$res=mysql_query($req);

echo "<table width='50%'>";
echo "<tr bgcolor=#8080FF><th>Référence</th><th>Désignation</th><th>Description</th><th>Prix unitaire (euro)</th></tr>";
$l=1;
while($ligne=mysql_fetch_array($res))
{
extract($ligne);
echo "<tr".($l % 2 ==0?" class=`impair`":"").">";
echo "<td><a href=ficheArticle.php?ref=$ref><font color=blue>".$reference."</font></a></td>";
echo "<td>".$designation."</td>";
echo "<td>".$description."</td>";
echo "<td>".$prix."</td>";
echo "</tr>";

$l++;
}
echo "</table>";
?> 
0
tita
 
j'ai toujours le meme problème là!!!!

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Users\tita\wamp\www\Materiels\promotion.php on line 9
0
Matthieu E.
 
Ce n'est pas la même erreur,
A quoi correspond la ligne 9?
C:\Users\tita\wamp\www\Materiels\promotion.php on line 9.
0
tita
 
voici la ligne 9

while($ligne=mysql_fetch_array($res))
0