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 4101 france tv - Forum Carte graphique
- Code erreur f3500-31 ✓ - Forum Bbox Bouygues
- Erreur 0x80070643 - Accueil - Windows
- Erreur 500 - Guide
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