PHP 未获取 Table 行数据,警告:mysqli_fetch_row() 期望参数 1 为 mysqli_result

PHP Not Fetching Table Row Data, Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result

谁能帮帮我? 我想显示完整的 mysql 数据库 table 结果,但出现错误:

我们联系上了。

警告:mysqli_fetch_row() 期望参数 1 为 mysqli_result,第 28 行 C:\xampp\htdocs\test\fetch.php 中给出的字符串


    $connection = mysqli_connect('127.0.0.1:3307','root','','loginapp');
    if($connection){

        echo "We are connected.";
    }

    $query = "SELECT * FROM users";

    mysqli_query($connection,$query);

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Display</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
</head>
<body>

    <div class="container">

        <div class="col-md-6">

<?php while($result = mysqli_fetch_row($query)){

        print_r($result);
    } ?>


  </div>


    </div>

</body>
</html>  ```


您直接在 mysqli_fetch_row() 函数中传递查询,您应该传递 mysql 查询

mysqli_query($connection,$query);到 $querynew = mysqli_query($connection,$query);并在 while($result = mysqli_fetch_row($querynew)){

中使用 $querynew

点赞

$connection = mysqli_connect('127.0.0.1:3307','root','','loginapp');
        if($connection){

            echo "We are connected.";
        }

        $query = "SELECT * FROM users";

        $querynew = mysqli_query($connection,$query);

        while($result = mysqli_fetch_row($querynew)){

            print_r($result);
        }