Reputation: 4544
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
Upvotes: 0
Views: 89
Reputation: 2819
Remove the bindparam
single quotes('
) around the question mark(?
)
$stmt = $mysql->prepare("INSERT INTO
projects_files (mid,filename,type)
VALUES (?,?,?)");
$stmt->bind_param('isi',$this->id,$File->filename,$File->type);
Upvotes: 1
Reputation: 6965
Don't put the question marks in quotes. The database will quote everything appropriately.
$stmt = $mysql->prepare("INSERT INTO projects_files (mid,filename,type) VALUES (?,?,?)");
$stmt->bind_param('isi',$this->id,$File->filename,$File->type);
Upvotes: 1