mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in

前端 未结 1 1543
我在风中等你
我在风中等你 2020-12-12 08:36


        
相关标签:
1条回答
  • 2020-12-12 09:02

    use AND insted of comma (,) in query near password that's why query returning false and throw that error

    $select = "SELECT id FROM loginregistration WHERE login ='".$login1."' and password ='".$password1."'";
    

    UPDATE 1

    if query fail it return false . so you can use mysqli_error($con); to know the error

        <?php
        require_once("connect.php");
    
        $login1 = $_POST['email'];
        $password1 = $_POST['password'];
        $select = "SELECT id FROM loginregistration WHERE login ='".$login1."' AND password   ='".$password1."'";
        $sql = mysqli_query($con,$select);
    
        if($sql === FALSE) { 
            die(mysqli_error($con)); // better error handling
        }
    
        $row = mysqli_fetch_assoc($sql);
        ?>
    
    0 讨论(0)
提交回复
热议问题