Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select1個月
我試圖建立一個MySQL查詢其選擇一個月內的所有活動中選擇所有日期。到目前爲止,我有這樣的:
public static function allMonthlyActivities($db, $startdate, $enddate) {
$sql = "SELECT shortdate FROM calendar WHERE date >= $startdate and <= $enddate";
$result = $db->listing($sql);
return $result;
}
而PHP執行是這樣的:
$list = Calendar::allMonthlyActivities($_DB, '2013-02-01', '2013-02-25');
但由於某些原因,我得到這個錯誤:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in...
這裏是我的數據庫結構:
如何正確地將日期(格式)傳遞給我的SQL語句,以便1個月內的所有日期都返回?
編輯 - 這裏是我的listing
功能
public function listing($sql) {
$result = mysql_query($sql, $this->_connection);
while($row=mysql_fetch_array($result)) {
$return[] = $row;
}
return $return;
}
你可以發佈'上市'功能嗎?或你在哪裏使用'mysql_fetch_array' – Sarfraz 2012-02-25 13:43:03
當然,在這裏你去。 – Michiel 2012-02-25 13:43:50