Bonjour, j'ai fait ce code et j'ai cet erreur
Notice: Undefined index: rechercherpar in C:\wamp\www\test1\banque\RechercherClient.php on line 54
Notice: Undefined index: mot_cle in C:\wamp\www\test1\banque\RechercherClient.php on line 55
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\test1\banque\RechercherClient.php on line 65
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\test1\banque\RechercherClient.php on line 66
Code html
<form action="RechecherClient.php" method="Post">
Rechercher par <select name="rechercherpar">
<option>id_client</option>
<option>Nom_Client</option>
<option>Prenom_Client</option>
</select>
Mot clé <input type="text" name="mot_cle">
<input type="submit" value="Rechercher">
code
Code php
<?php
//Connexion Mysql
require("Mysql_Connect.php");
function search()
{
$champ=$_POST['rechercherpar'];
$mot=$_POST['mot_cle'];
$sql = "SELECT * FROM client
WHERE $champ=\"$mot\"";
// Affichage de la requête si besoin:
echo "<center><br><b></b></br></center>";
// Lancement de la requête :
$resultat=mysql_query($sql);
$ligne=mysql_fetch_array($resultat);
$nb=mysql_num_rows($resultat);
$i=0;
while($i<$nb)
{
$num=$ligne['id_client'];
$type=$ligne['Nom_Client'];
$soustype=$ligne['Prenom_Client'];
echo $num.' '.$type.' '.$soustype;
$i=$i+1;
}
}
search();
?>
lifa8
Afficher la suite