warning problem: expects parameter 1 to be mysqli_result
mysqli_query()
returns FALSE
if there was an error in the query. So you should test for it...
/* Select queries return a resultset */
if ($result = mysqli_query($dbc, "SELECT Name FROM City LIMIT 10")) {
printf("Select returned %d rows.\n", $result->num_rows);
/* free result set */
$result->close();
}
See this link for the mysqli_query
reference
http://php.net/manual/en/mysqli.query.php