检查局部变量是否等于局部变量的正确方法


Correct way to check if local variable equals local variable

即使值应该相等,它也不会求值,并且直接进入else事件。表列名与数据库匹配,因此…

我需要在($recruitcheck==$recruditpass)中引用某种类型的引号吗?

$recruiter = $_POST["recruiter"];
$recruitpass = $_POST["recruitpass"];
$recruitcheck = mysqli_query($maindb, "select aurapass from auras where auraname='$recruiter'");
if($recruitcheck == $recruitpass) {
    $badgecheck = mysqli_query($maindb, "select recruitbadge from auras where auraname='$recruiter'");
    if($badgecheck == "0") {
        echo "<script>alert('Recruiter information correct, but there is no recruit badge.')</script>";
        exit();
    } else {
        echo "<script>alert('Recruiter badge accepted.')</script>";
        $emailcheck = mysqli_query($maindb, "select * from auras where email='$email'");
        $namecheck = mysqli_query($maindb, "select * from auras where auraname='$auraname'");
        if(mysqli_num_rows($emailcheck) > 0 || mysqli_num_rows($namecheck) > 0){
            echo "<script>alert('New auraname/email is already taken.')</script>";
            exit();
        } else {
            exit();                        
        }
    }
} else {
    echo "<script>alert('Aura information of recruiter is incorrect. Please, use preexisting aura information to confirm recruiter identity.')</script>";
    exit();
}

$recruitpass是一个字符串,而$recruptcheck是mysqli_result对象。在将其与$recruitpass 进行比较之前,您需要获取对象内部的字符串值