Mysql erreur
jaydailfr
Messages postés
123
Statut
Membre
-
jaydailfr Messages postés 123 Statut Membre -
jaydailfr Messages postés 123 Statut Membre -
Bonjour,
Bonjour,voil la mon erreur
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%%' at line 1
<html>
<form method="POST" action="">
Rechercher un mot : <input type="text" name="recherche">
<input type="SUBMIT" value="Search!">
</form>
</html>
<?php
//connection au serveur:
$cnx = mysql_connect( "localhost", "root", "" ) ;
// Récupère la variable
$recherche = isset($_POST['recherche']) ? $_POST['recherche'] : '';
// la requete mysql
$sql = mysql_query("SELECT name FROM spip_fuaj_adherents WHERE name LIKE %$recherche%") or die (mysql_error());
// affichage du résultat
while(list($name)=mysql_fetch_array($sql)){
echo 'Resultat de la recherche: '.$name.' <br />';
}
?>
Bonjour,voil la mon erreur
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%%' at line 1
<html>
<form method="POST" action="">
Rechercher un mot : <input type="text" name="recherche">
<input type="SUBMIT" value="Search!">
</form>
</html>
<?php
//connection au serveur:
$cnx = mysql_connect( "localhost", "root", "" ) ;
// Récupère la variable
$recherche = isset($_POST['recherche']) ? $_POST['recherche'] : '';
// la requete mysql
$sql = mysql_query("SELECT name FROM spip_fuaj_adherents WHERE name LIKE %$recherche%") or die (mysql_error());
// affichage du résultat
while(list($name)=mysql_fetch_array($sql)){
echo 'Resultat de la recherche: '.$name.' <br />';
}
?>
A voir également:
- Mysql erreur
- Mysql community download - Télécharger - Bases de données
- Erreur t32 ✓ - Forum Livebox
- Erreur 3000 france tv - Forum Lecteurs et supports vidéo
- Erreur 0x80070643 - Accueil - Windows
- Erreur 0x80070643 Windows 10 : comment résoudre le problème de la mise à jour KB5001716 - Accueil - Windows
6 réponses
Je mettrais des ' (simple quote) autour de '$recherche'
SELECT name FROM spip_fuaj_adherents WHERE name LIKE %'$recherche'%") or
SELECT name FROM spip_fuaj_adherents WHERE name LIKE %'$recherche'%") or
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question