Bonjour à tous,
Alors voila j'ai un petit problème, je tente d'insérer des données dans ma base à partir d'un formulaire et j'ai 2 erreurs.
et voila mon codeFatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 ':Identifiant, :pass, :email, :localisation, :grade)' at line 1' in C:\wamp\www\test\register.php on line 132 et
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 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 ':Identifiant, :pass, :email, :localisation, :grade)' at line 1 in C:\wamp\www\test\register.php on line 132
Merci d'avance pour l'aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 $query=$bdd->query('INSERT INTO personne (Identifiant, MotDePasse, email, localisation, grade) VALUES (:Identifiant, :pass, :email, :localisation, :grade)'); $query->bindValue(':Identifiant', $Identifiant, PDO::PARAM_STR); $query->bindValue(':pass', $pass, PDO::PARAM_INT); $query->bindValue(':email', $email, PDO::PARAM_STR); $query->bindValue(':localisation', $localisation, PDO::PARAM_STR); $query->bindValue(':grade', $grade, PDO::PARAM_STR); $query->bindValue(':temps', $temps, PDO::PARAM_INT); $query->execute(); //Et on définit les variables de sessions $_SESSION['Identifiant'] = $Identifiant; $_SESSION['id'] = $bdd->lastInsertId(); ; $_SESSION['level'] = 2; $query->CloseCursor();
Partager