为什么这不起作用
$sth = $pdo->prepare("SELECT * FROM tempusers WHERE tempusers.username = :username AND tempuser.email = :email AND password = :password");
$sth->bindParam(':username', $register_data['username'], PDO::PARAM_STR);
$sth->bindParam(':email', $register_data['email'], PDO::PARAM_STR);
$sth->bindParam(':password', $register_data['password'], PDO::PARAM_STR);
$sth->execute();
if($sth->fetchColumn() > 0) {
echo 'yes';
}else{
echo 'no';
}
然后当我运行这段代码时它可以工作
$sth = $pdo->prepare("SELECT * FROM tempusers WHERE tempusers.username = :username");
$sth->bindParam(':username', $register_data['username'], PDO::PARAM_STR);
$sth->execute();
if($sth->fetchColumn() > 0) {
echo 'yes';
}else{
echo 'no';
}
当我尝试在 bindParam 值上使用更多时,代码会崩溃。为什么不能有更多的一个值来检查?