PHP error for query results expects parameter

Viewed 13

I updated my PHP and I am getting this error.

mysqli_fetch_array() expects parameter 1 to be mysqli_result,

I understand it has no results. But if there is no results I want it to just have no results.

Is there a way to bypass this? I cannot just throw error at the end as it just stops loading page. Is this a PHP setting?

$query = "SELECT * FROM  `users` ORDER BY id DESC";
$result = mysqli_query($conn,$query);
while($row=mysqli_fetch_array($result)){
 echo $row['id'];   
}
0 Answers
Related