I have troubles when I use "PDO prepare" :
$sql ="INSERT INTO table (id, reponse_id_num_quest , reponse__rep, reponse__commentaire) VALUES (:id, :id_quest, :val, :comm)";
$res=$db->prepare($sql);
$res->bindParam(':id',$idUniq);
$res->bindParam(':id_quest',$ids[$index]);
$res->bindParam(':val',$val);
$res->bindParam(':comm',$commentaire, PDO::PARAM_STR);
$res->execute();
When the variable "$commentaire" contains a string with quote " ' " or backslash, the query insert backslash before the special character.
Ex:
Original string : I don't
In base string : I don\'t
So, on the final HTML view, the string isn't the original.
How could I insert correctly ? Thanks