-3
中給出如何解決此錯誤?搜索所有答案,但無法找到解決方案,請幫助我。PHP警告:mysql_fetch_array()期望參數1是資源,布爾在
line error:while($ record = mysql_fetch_array($ result)) line error:list($ id,$ aRecord [$ id])= $ record;
function getSelectData($DBName, $DBField, $allData = true, $DBOrderField = "0", $check_auth = false)
{
if($DBOrderField == "0")
{
$DBOrderField = $DBField;
}
if($allData == true)
{
$whereCondition = " WHERE %auth_filter%";
}
else
{
$whereCondition = " WHERE " . $DBName . "_id <> 0 AND %auth_filter%";
}
$query = "\n SELECT " . $DBName . "_id, " . $DBField . " AS name\n FROM " . $DBName . " " . $whereCondition . "\n ORDER BY " . $DBName . "." . $DBOrderField;
return getSelectData_custom($DBName, $query, $check_auth);
}
function getSelectData_custom($DBTable, $query, $check_auth = false)
{
$result = db_query($DBTable, $query, array(), $check_auth);
$aRecord = array();
while($record = mysql_fetch_array($result))
{
if(!empty($record[1]) && !is_null($record[1]))
{
list($id, $aRecord[$id]) = $record;
}
}
return $aRecord;
}
你是先搜索stackoverflow嗎? http://stackoverflow.com/questions/15001452/persistent-warning-mysql-fetch-array-expects-parameter-1-to-be-resource –