Est-ce que quelqu'un peux m'aider, j'ai un probleme avec cet enonce:
$reponse = $bdd->query('select email, motpasse from inscription where and inscrit = 1');
Le probleme se situe au niveau du 1, (inscrit = 1 )
Le message est :
Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: 1064 Erreur de syntaxe près de 'and inscrit = 1' à la ligne 1 in C:\wamp64\www\syndicat\test.php on line 14
Fatal error: Uncaught Error: Call to a member function fetch() on boolean in C:\wamp64\www\syndicat\test.php on line 15
( ! ) Error: Call to a member function fetch() on boolean in C:\wamp64\www\syndicat\test.php on line 15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <?php
try
// Se connecte a MYSQL
{
$bdd = new PDO('mysql:host=localhost;dbname=condos;charset=utf8', 'root', '');
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO:: ERRMODE_WARNING);
}
catch (Exception $e) // Teste si il y a erreur dans la connection
{
die('Erreur : ' . $e->getMessage());
}
$reponse = $bdd->query('select email, motpasse from inscription where and inscrit = 1');
while ($donnees = $reponse->fetch())
{
echo $donnees['inscrit'] . ' appartient à ' . $donnees['email'] . '<br />';
}
$reponse->closeCursor();
?> |
Partager