我的代码是
$query1 = "SELECT `user_id` FROM `it_user` WHERE (user_email_address = ? AND user_mobile_number_verified = NULL)";
$stmt1 = $mysqli->prepare($query1);
$stmt1->bind_param("s",$email);
$stmt1->execute();
if ($stmt1->affected_rows == 1) {
//set registration flag to 1 stating that the users mobile number is already verified
echo '<meta http-equiv="refresh" content="0; URL=''../signin/''"/>';
}
else
{
$registration_flag = 2;
//redirect user to error page
//echo '<meta http-equiv="refresh" content="0; URL=''../error/''"/>';
}
我收到此错误::
在第 62 行的 ***** 中的非对象上调用成员函数 bind_param()
由于我的电子邮件变量正在工作,查询也是如此。
使用 NULL 安全运算符并编写如下代码:-
$mobile = NULL; // NOTE: no quotes - using php NULL
$query1 = "SELECT `user_id` FROM `it_user` WHERE user_email_address = ? AND user_mobile_number_verified <=> ?";
$stmt1 = $mysqli->prepare($query1);
$stmt1->bind_param("s",$email);
$stmt1->bind_param($mobile);
$stmt1->execute();
希望对您有所帮助:-)