I have this error but I don't understand why :(
Fatal 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 'Match = 1 WHERE
Utilisateur_idUtilisateur = 1' at line 1' in
C:\wamp\www\Sitepersonnelle\AjouterMatch.php on line 14
And here is my SQL req
$bdd->exec("UPDATE classement SET Match =+ 1 WHERE Utilisateur_idUtilisateur = $JoueurDomicile");
Answer
match
is a reserved word in MySQL. Either use backticks to escape it or use another name for your column.
UPDATE classement
SET `Match` = `Match` + 1
WHERE Utilisateur_idUtilisateur = '$JoueurDomicile'
And if $JoueurDomicile
is a string then put quotes around it.
And there is no =+
operator in MySQL, nor in any other lanuage it know.
No comments:
Post a Comment