警告:mysqli_query():第15行的C:\ xampp \ htdocs \ IT \ Adsware.com \ recover.php中的空查询

时间:2018-06-16 17:39:32

标签: php mysql mysqli

这可能是什么原因?我希望它查询数据库并在数据库中存在指定的电子邮件时发送用户消息,否则标记错误

<?php  
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    include 'includes/config.php';
    include 'includes/functions.php';
    $email = benny($_POST['email']);
    $from = "support@Adsware.com";
    $subject = "Password Reset";
    $msg = "Hello, you have requested to reset your password";
    $to = $email;
    if (empty($_POST['email'])) {
        echo "<script> alert(\"Please Enter your Email Address.\") </script> ";
    }else{
        $sql = "SELECT * FROM users WHERE email = $email";              
    }
    if (mysqli_query($con, $sql)) {
        if(mail($to, $subject, $msg)){
            echo "<script> alert(\"An Email with password reset link has been sent to your email inbox. Please Check it\") </script>";
        }else{
            echo "<script> alert(\"Email does not Exist\") </script>";
        }
    }else{
        echo "<script> alert(\"Error Encountered\") </script>";
    }
}
?>

<form name="recover" action="" method="POST" autocomplete="off">            
    <label>Username</label>
    <input type="email" name="email" placeholder="Enter Your Email">
    <input class="login-sub" type="submit" name="submit" value="Reset Password">
</form>
<a href="login.php"><button id="Login"> Login </button></a>

但它显示错误:

  

警告:mysqli_query():中的空查询   第15行的C:\ xampp \ htdocs \ IT \ Adsware.com \ recover.php

0 个答案:

没有答案