기능 (MySQL의에서 이상 전환), 그리고 내가 중복 이메일을 확인 내 로그인 스크립트에 문제가 오전 : 여기mysqli 준비된 문 NUM_ROWS는 그래서 MYSQLi에서 근무하는 첫날입니다
것은 내가했습니다 것입니다 got30 :
$email = mysqli_escape_string($_POST['email']);
$stmt=$mysqli->prepare("SELECT username from users WHERE email=?");
$stmt->bind_param('s',$email);
$stmt->execute();
$nrows1=$mysqli->num_rows;
echo $nrows1;
$stmt->close();
if ($nrows1>0) {
$_SESSION['loggedin'] = false;
$_SESSION['error'] = "Our records indicate that there is already an account registered with that email. Please use the 'forgot your password' link below if you cannot remember your password.";
header('Location: registration.php');
echo "running insisde duplicate email";
exit();
}
$ nrows1을 울릴 때 계속 0 행 또는 빈 변수를 반환합니다. SQL에서 직접 쿼리를 입력하면 올바르게 작동합니다. 나는 그 서류들을 따르고있는 것처럼 보이고 그걸로 무리를 꾸몄다.
영향을받는 행 함수도 사용했지만 SELECT 문에 적합하다고 생각하지 않습니다. 맞습니까?
도움을 주신 모든 분들께 진심으로 감사드립니다.
'bind_param'을 사용하는 경우 매개 변수를 벗어날 필요가 없다고 생각합니다. – tsnorri
감사합니다. 그래, 실제로 그걸 막고 있었어. – ambe5960