Reputation: 14711
This is a piece of php code that I've written and I get a HY093 error, which according to what I've read is either a binding error or an error regarding the number of parameters passed or their quality, but I dont see anything wrong with my code.
Could it be that some of the variables is null when I'm passing it to the statements?
$sth = $connection->prepare(
"UPDATE `user_settings`
SET
user_show_money = :user_show_money,
user_show_stats = :user_show_stats,
user_accept_messages = :user_accept_messages,
user_interact_with_activities = ':user_interact_with_activities'
WHERE
user_id = ':user_id'"
);
$sth->execute(
array(
':user_show_money' => $user_show_money,
':user_show_stats' => $user_show_stats,
':user_accept_messages' => $user_accept_messages,
':user_interact_with_activities' => $user_interact_with_activities,
':user_id' => $user_id
));
$sth2 = $connection->prepare(
"UPDATE `users`
SET
user_name = :user_name,
user_avatar = :avatar_path,
user_sex = :user_sex,
user_password = :user_password,
user_quote = :user_quote
WHERE
user_id = :user_id"
);
$sth2->execute(
array(
':user_name' => $user_name,
':avatar_path' => $avatar_path,
':user_password'=> $user_password,
':user_sex' => $user_sex,
':user_quote' => $user_quote,
':user_id' => $user_id
));
Upvotes: 0
Views: 54
Reputation: 158007
It's quite surprising you cannot find anything as this question has been asked many many many times already. And answers were listed to you while you typed your question.
For some reason you put your placeholders in quotes while you shouldn't.
Upvotes: 1