Recent Posts

Showing posts with label parameter. Show all posts
Showing posts with label parameter. Show all posts

How to solve: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given

First and foremost:

This happens when you try to fetch data from the result of mysql_query but the query failed.

This is a warning and won't stop the script, but will make your program wrong.

You need to check the result returned by mysql_query by:

$res = mysql_query($sql);
if (!$res) {
   die(mysql_error());
}
// after checking, do the fetch