J'ai le message erreur suivant :
Code : Tout sélectionner
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Vente de voitures miniatures2\inc_php\catalogue.inc.php on line 51include_once('connect_free.inc.php');
$sql_marque="SELECT id,nom FROM marque_voiture";
?>
<form method="POST" action="catalogue.inc.php">
<select name="Marque" >
<?php
$marque=mysql_query($sql_marque);
while ($row_marque=mysql_fetch_assoc($marque))
{
echo '<option>'.$row_marque['nom'].'</option>';
}
?>
</select><input type="submit" value="rechercher" name="rechercher"><p>
<?php
if (empty($_POST))
{
echo 'marque = '.$_POST['Marque'];
$sql_liste="SELECT couleur, disponible, prix_ht, echelle, poids, description, marque_voiture.nom AS marq, type_voiture.nom AS typev, fabricant.nom AS fabriq, voiture.annee AS annee_voiture
FROM voiture, marque_voiture, fabricant, type_voiture
WHERE id_type = type_voiture.id
AND id_marque =marque_voiture.id
AND id_fabricant = fabricant.id";
}
else
{
echo 'marque = '.$_POST['Marque'];
$sql_liste="SELECT couleur, disponible, prix_ht, echelle, poids, description, marque_voiture.nom AS marq, type_voiture.nom AS typev, fabricant.nom AS fabriq, voiture.annee AS annee_voiture
FROM voiture, marque_voiture, fabricant, type_voiture
WHERE id_type = type_voiture.id
AND id_marque =marque_voiture.id
AND id_fabricant = fabricant.id
AND marq='".$_POST['Marque']."'";
}
?>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tr>
<td>couleur</td>
<td>Disponible</td>
<td>Prix HT</td>
<td>Echelle</td>
<td>Poids</td>
<td>Marque</td>
<td>Type Voiture</td>
<td>Fabricant</td>
<td>Année</td>
</tr>
<?php
$liste=mysql_query($sql_liste);
while ($row_liste=mysql_fetch_assoc($liste))
{
echo '<tr><td>'.$row_liste['couleur'].'</td>';
echo '<td>'.$row_liste['disponible'].'</td>';
echo '<td>'.$row_liste['prix_ht'].'</td>';
echo '<td>'.$row_liste['echelle'].'</td>';
echo '<td>'.$row_liste['poids'].'</td>';
echo '<td>'.$row_liste['marq'].'</td>';
echo '<td>'.$row_liste['typev'].'</td>';
echo '<td>'.$row_liste['fabriq'].'</td>';
echo '<td>'.$row_liste['annee_voiture'].'</td></tr>';
}
?>
</table>
</form>