Issue with php/mysql prepared insert statement
968
I might just be too dumb to see it but here is my issue:
Code:
$stmt = $mysql->prepare("INSERT INTO projects_files (mid,filename,type) VALUES ('?','?','?')");
$stmt->bind_param('isi',$this->id,$File->filename,$File->type);
Error:
Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement
I have checked that all vars are assigned and have a value and the datatypes are all right.
Thanks in advance for help
Answer
Solution:
Don't put the question marks in quotes. The database will quote everything appropriately.
Answer
Solution:
Remove the
bindparam
single quotes('
) around the question mark(?
)