I have a basic PDO Update Statement which is not working. I can't find why...Can anybody help me ?
$conn = new PDO("mysql:host=$host;dbname=$db", $login, $mdp);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$requete=$conn->prepare("UPDATE eleves
SET id_ecole = ?,
id_classe = ?,
id_eleve = ?,
nom = ?,
prenom = ?,
date_naiss = ?,
tel = ?,
mail = ?,
sortie = ?,
photo = ?,
cantine = ?,
religion = ?
WHERE (id_ecole = $id_ecole
AND id_classe = $id_classe
AND id_eleve = $id_eleve);");
$requete->execute(array($id_ecole, $id_classe, $id_eleve,
$nom, $prenom, $date_naiss, $tel,
$mail, $sortie, $photo, $cantine,
$religion));
The table "eleves" contains an additional column which acts as an auto-increment key
Note that the following query works well :
$conn = new PDO("mysql:host=$host;dbname=$db", $login, $mdp);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$requete=$conn->prepare("INSERT INTO eleves (id_ecole, id_classe,
id_eleve, nom, prenom, date_naiss,
tel, mail, sortie, photo, cantine, religion)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
$requete->execute(array($id_ecole, $id_classe, $id_eleve, $nom,
$prenom, $date_naiss, $tel, $mail,
$sortie, $photo, $cantine, $religion));
Thank you !