Je désire faire une recherche sur mon site avec 2 requètes.
J'ai dabord crée une table annonce 7 avec les champs texte,categorie et departement.
Voila le code de la 1ère page
Code : Tout sélectionner
<html >
<head>
<title>Document sans titre</title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:62px;
top:130px;
width:627px;
height:266px;
z-index:1;
}
#Layer2 {
position:absolute;
left:70px;
top:100px;
width:647px;
height:226px;
z-index:1;
}
-->
</style>
</head>
<body>
<div id="Layer2">
<form id="form1" name="form1" method="post" action="recherche3.php">
<table width="527" height="160" border="0" cellpadding="0">
<tr>
<td width="144"><div align="right"></div></td>
<td width="186"><div align="center">
<select name="endroit" id="endroit">
<option value="00">tous les départements</option>
<option value="75007">75</option>
</select>
</div></td>
<td width="189"><div align="center">
<select name="quoi" id="quoi">
<option value="00">Toutes les catégories</option>
<option value="voiture">voiture</option>
</select>
</div></td>
</tr>
<tr>
<td height="58" colspan="3"><div align="center">
<input type="submit" name="Submit" value="rechercher" />
</div></td>
</tr>
</table>
</form>
</div>
</body>
</html>
Code : Tout sélectionner
<html >
<head>
<title>Document sans titre</title>
</head>
<body>
<?php
$liendb = mysql_connect("nomduserveur","identifiant","passe");
mysql_select_db ("nomdelabase");
$sql= "SELECT texte FROM annonce7 WHERE categorie=$quoi AND departement=$endroit";
$resultat =mysql_query($sql);
while ($eleve =mysql_fetch_array($resultat))
{
$texte =$eleve['texte'];
echo "$texte";
}
mysql_close($liendb);
?>
</body>
</html>
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /.../recherche3.php on line 13
Puis-je avoir de l'aide merci d'avance.