Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in

mysqli_fetch_array()‘s 1st parameter must be a result of a query. What you are doing is you are passing the connection (which doesn’t make sense) and the query command itself.

Read the doc here: http://php.net/manual/en/mysqli-result.fetch-array.php

To fix this, execute the query first, then store the result to a variable then later fetch that variable.

$sql = "select * from privinsi";
$result = mysqli_query($connection,$sql);
while($r = mysqli_fetch_array($result))
{
    // your code here
}

Leave a Comment