Bonsoir,

j'ai un souci pour insérer une date alors que c'est bon pour les autres champs ; voici le code :
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
$connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql='INSERT into `CONSULTATION` (id_praticien, id_patient,id_consultation_type, date_consultation) VALUES (:id_praticien,:id_patient,:id_consultation_type,:date_consultation)';
$prep = $connexion->prepare($sql);
echo "date:".$_POST['date_consultation'];
 
//Associer des valeurs aux place holders
$prep->bindValue(':id_praticien', $id_praticien, PDO::PARAM_INT);
$prep->bindValue(':id_patient', $id_patient, PDO::PARAM_INT);
$prep->bindValue(':id_consultation_type', $id_consultation_type, PDO::PARAM_INT);
$prep->bindValue(':date_consultation',$_POST['date_consultation'], PDO::PARAM_STR);
 
$prep->execute();
et la date s'affiche correctement. Donc comment faire ?