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.

How to use mysqli_query() in PHP?

I have to admit, mysqli_query() manual entry doesn’t contain a clean example on how to fetch multiple rows. May be it’s because the routine is so routine, known to PHP folks for decades: In case you want to print the column titles, you have to select your data into a nested array first and then use keys … Read more