Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
I'm trying to build a MySQL query which selects all activities within one month. So far, I've got this:
public static function allMonthlyActivities($db, $startdate, $enddate) {
$sql = "SELECT shortdate FROM calendar WHERE date >= $startdate and <= $enddate";
$result = $db->listing($sql);
return $result;
}
And the PHP executing this is:
$list = Calendar::allMonthlyActivities($_DB, '2013-02-01', '2013-02-25');
But for some reason, I get this error:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in...
Here is my database structure:
How do I pass dates correctly (which format) to my SQL statement so all dates from 1 month return?
EDIT - here is my listing
function
public function listing($sql) {
$result = mysql_query($sql, $this->_connection);
while($row=mysql_fetch_array($result)) {
$return[] = $row;
}
return $return;
}