0

I just have a little problem that I can not solve. I made a form to add an accommodation in a database and photos in files. The query is working normally but I have an error for several hours that I can not understand and see about my problem.

Here is the code:

if(move_uploaded_file($_FILES["imageheb"]["tmp_name"], $imgtarget) && move_uploaded_file($_FILES["photoheb"]["tmp_name"], $phttarget)){

$insertheb = $bdd->prepare("INSERT INTO hebergement(codetypeheb, nomheb, imageheb, nbplaceheb, surfaceheb, internet, anneeheb, secteurheb, orientationheb, etatheb, descriheb, photoheb, tarifsemheb) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)");

$insertheb->execute(array($codetypeheb, $nomheb, $nomimg, $nbplaceheb, $surfaceheb, $internet, $anneeheb, $secteurheb, $orientationheb, $etatheb, $descriheb, $tarifsemheb ));
                                
$valide = "Good !";
                              }

Here is my mistake:

Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in C:.....

I continue my research, thank you good day

1 Answers1

0

There is 13 placeholders in prepared sql statement and only 12 values in array in your code

NobbyNobbs
  • 1,341
  • 1
  • 11
  • 17