Probleme php
tita
-
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!!
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:
- Probleme php
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Retour a la ligne php - Forum Webmastering
- Alert php - Forum PHP
- Retour a la ligne php ✓ - Forum PHP
3 réponses
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>"; ?>