I convert my php code from mysqli to pdo and i got this problem (Fatal error: Uncaught Error: Call to a member function bindValue() on boolean) and i don't understand why i have this issue, if someone know where does this problem come from, it can help me a lot (it's for a school project). I don't have any boolean in this code :
// Insert the data from the form into the database
function insertionDesDonnees($nom, $prenom, $etabActuelle, $formActuelle, $mail, $telephone, $ville, $codePostale, $numeroRue, $nomRue, $baseDeDonnees)
{
$requeteInsertion = $baseDeDonnees->prepare("INSERT INTO visiteur(nomVisit, prenomVisit, mailVisit, telVisit, rueVisit, locRueVisit, CPVisit, villeVisit, etabOrigVisit, formActu) VALUES (:nom, :prenom, :mail, :telephone, :nomRue, :numeroRue, :codePostale, :ville, :etabActuelle, :formActuelle);");
$requeteInsertion->bindValue(':nom',$nom,PDO::PARAM_STR); // i got the problem here
$requeteInsertion->bindValue(':prenom', $prenom, PDO::PARAM_STR);
$requeteInsertion->bindValue(':mail', $mail, PDO::PARAM_STR);
$requeteInsertion->bindValue(':telephone', $telephone, PDO::PARAM_INT);
$requeteInsertion->bindValue(':nomRue', $nomRue, PDO::PARAM_STR);
$requeteInsertion->bindValue(':numeroRue', $numeroRue, PDO::PARAM_STR);
$requeteInsertion->bindValue(':codePostale', $codePostale, PDO::PARAM_INT);
$requeteInsertion->bindValue(':ville', $ville, PDO::PARAM_STR);
$requeteInsertion->bindValue(':etabActuelle', $etabActuelle, PDO::PARAM_STR);
$requeteInsertion->bindValue(':formActuelle', $formActuelle, PDO::PARAM_STR);
$requeteInsertion->execute();
}
In my database it's a varchar variable, then i don't understand how to resolve this problem.
Any help will be much appreciated.
I tried a lot of thing, i can re try it, it not a problem for me.