这是我的代码......
对于功能
它没有更新激活。
function activate($email, $email_code){
$email = mysql_real_escape_string($email);
$email_code = mysql_real_escape_string($email_code);
mysql_result(mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `email` = '$email' AND `email_code` = '$email_code' AND `activated` = 0"), 0) == 1)
if(mysql_query("UPDATE `users` SET `activated` = 1 WHERE `email` = '$email'")){
return true;
}
else{
return false;
}
}
答案 0 :(得分:0)
您应该在放置变量时删除引号,例如:
"SELECT COUNT(`user_id`) FROM `users` WHERE `email` = "
+ $email
+ " AND `email_code` = "
+ $email_code
+ " AND `activated` = 0"
"UPDATE `users` SET `activated` = 1 WHERE `email` = " + $email