这是我编写的一段PHP代码,我收到一个HY093错误,根据我所读到的是绑定错误或关于传递的参数数量或其质量的错误,但我我的代码没有看错。
当我将它传递给语句时,是否有些变量为空?
$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
));
答案 0 :(得分:1)
令人惊讶的是你找不到任何东西,因为这个问题已被问过很多次了。在您输入问题时,会向您列出答案。
出于某种原因,您将占位符放在引号中,而不应该。