如何修复mysqli_query()需要参数1

时间:2019-03-23 05:55:48

标签: php mysqli

更换主机后,我遇到了问题。 已连接

  

警告:mysqli_query()期望参数1为mysqli,布尔值   在第11行的/home/myterst/public_html/video/index.php中给出

     

警告:mysqli_fetch_array()期望参数1为mysqli_result,   在第12行的/home/myterst/public_html/video/index.php中给出的null

<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
    include('include/config.php');
    session_start();

if (isset($_POST['login'])) 
{
    $email = $_POST['email'];
    $password = $_POST['password'];

    $qry = mysqli_query($conn,"select * from status_users where email='$email' and password='$password'");
    $result = mysqli_fetch_array($qry);

    if($result) {
         $_SESSION['email'] = $result['email'];

        echo "<script>window.location='dashboard.php';</script>";

        } else {

        $danger = "Invalid Username or Password";
    }
}
?>

1 个答案:

答案 0 :(得分:-1)

尝试一下。.我希望它能正常工作

   $qry = "select * from status_users where email='$email' and password='$password'";

   $result = mysqli_query($conn,$qry);

   $row = mysqli_fetch_array($result,MYSQLI_NUM);