PHP PDO mise à jour de l'instruction préparée

Je suis en train de mettre à jour ma base de données avec la requête suivante:

$sth = "UPDATE rpacks SET rpacks_location VALUES (:location) WHERE rpacks_id = (:id)";
$q = $conn->prepare($sth);
$q->execute(array(':location'=>$location, ':id'=>$id));

Mais j'obtiens cette erreur

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 'VALUES ('test') WHERE rpacks_id = ('2')' at line 1' in

  • Votre instruction SQL a une erreur, vous devriez utiliser SET champ = (:quelque Chose) et non pas les valeurs
InformationsquelleAutor twigg | 2013-04-14