Unexpected result in database query

0
<?php
class Login{
    public function logar($email,$senha){
        $connect=new DB;
        $connect=$connect->conectar();

        $sql="select * from usuarios where email='$email' and senha='$senha' and status='1' limit 1;";
        $buscar=mysqli_query($connect,$sql);
        $result=mysqli_num_rows($buscar);
        if ($result==1) {
            $log=1;
            $dados=mysqli_fetch_array($buscar);
            $_SESSION["email"]=$dados["email"];
            $_SESSION["senha"]=$dados["senha"];
            $_SESSION["nivel"]=$dados["nivel"];
            setcookie("logado",1);

        }
        if (isset($log)) {
            $flash="Logado com sucesso!";
        }else{
            $flash="Verifique se as informações inseridas estão corretas!";
        }
        echo $flash;
    }
}
?>

Does this above code exist that makes it impossible for the query to be other than '1'? We assume the following situation: in my database there is an email record:'[email protected] 'and password:' admin ' so when running this code by entering the correct information the response shown on the screen is "Verify that the information entered is correct!"?

    
asked by anonymous 26.12.2017 / 23:17

1 answer

0

Thanks to those who commented, but I managed to resolve. Whomever interested, the problem was in the database where all records were saved with status 0, in the SQL command it gives a SELECT ... WHERE status = 1.

    
27.12.2017 / 03:18