如何将多个参数绑定到 MySQLi 查询 [已关闭]
我有一个mysql查询,但我无法绑定它的参数
SELECT users.email,users.handle,userprofile.mobile FROM users,userprofile WHERE users.email =? OR users.handle =? OR userprofile.mobile=?
我试过下面行
$query = "SELECT users.email,users.handle,userprofile.mobile FROM users,userprofile WHERE users.email =? OR users.handle =? OR userprofile.mobile=?";
$stmt = $mysqli->prepare($query);
$stmt->bind_param("sss",$email,$username,$mobile);
if ($stmt->execute()) {
if($stmt->num_rows){
echo '......';
}
}
但我收到并出错:
警告:mysqli_stmt::bind_param(): 类型定义字符串中的元素数与绑定变量数不匹配