mysqli_query()返回完整表的空结果

I am making a page that queries a table for all columns of all results ordered by entry time in descending order with a limit. When I query for a count of the rows, the query works just fine, but when I try to query the table again for data, I don't get anything. I decided to try cutting the query down to "SELECT * FROM comments" but I still got no results when "SELECT COUNT(*) AS count FROM comments" just beforehand worked. I've tried using mysqli_error(), but that didn't give me any information.

The query doesn't seem to be failing as the result from mysqli_query() isn't false and when I query in phpMyAdmin, the queries work. A little piece of my code below

//open databases
require_once($root . "databases/data.php");

//get number of suggestions in comments table
$cquery = mysqli_query($cbase, "SELECT COUNT(*) AS count FROM comments"); //this works
$c = mysqli_fetch_array($cquery);
$count = $c["count"];

//get all suggestions
//this query fails
$queryText = "SELECT * FROM comments ORDER BY time DESC LIMIT " . (($page - 1) * $pageLimit) . ", " . $pageLimit;
$query = mysqli_query($cbase, $queryText);

//validate query
if($query === false)
{
    $failed = true;
}

//get all comments from query
while(!$failed && $array = mysqli_fetch_array($result))

Please try this on line 3

$c = mysqli_fetch_assoc($cquery);

You can also try like this also,

$c = mysqli_fetch_array($cquery, MYSQLI_ASSOC);

You are just using the wrong variable when reading out your query results in your while-loop. mysqli_fetch_array($result) while you saved the query-result in $query so it should be mysqli_fetch_array($query)