Possible Duplicate:
PHP: Warning: sort() expects parameter 1 to be array, resource given警告:mysql_fetch_array()預計參數1是資源,布爾在等給出
我得到的錯誤:
警告:mysql_fetch_array()預計參數1是資源,布爾在C中給出: \ allthewaytthroughmyfolders \ WWW \ filterresultaat.php上線103
while ($regel = mysql_fetch_array ($filterres))
{
echo
'<tr>
<td>'
.$regel['Opleiding'].
'</td>
<td>'
.$regel['S_datum'].
'</td>
<td>'
.$regel['Duur'].
'</td>
<td>'
.$regel['omschrijving'].
'</td>
<td>'
.$regel['vergoeding'].
'</td>
<td>'
.$regel['Stad'].
'</td>
<td>'
.$regel['Straat'].
'</td>
<td>'
.$regel['Huisnr'].
'</td>
<td>'
.$regel['postcode'].
'</td>
<td>'
.$regel['land'].
'</td>
<td>'
.$regel['contactpersoon'].
'</td>
</tr>';
}
這是奇怪的,因爲它是一個小時前的工作。
任何人都可以幫忙嗎?
編輯:
if (isset($opleiding))
{ $opleidingq = 'opleiding = "'.$opleiding.'" and'; }
if (isset($duur))
{
if($duur = 30)
{
$duurq = ' ';
}
else
{
$duurq= 'duur= "'.$duur.'" and';
}
}
else
{ $duurq = ' ';
}
if (isset($type))
{ $typeq= 'type= "'.$type.'" and'; }
$filter = "SELECT * FROM opdracht WHERE $opleidingq $duurq $typeq gevuld ='nee';";
//mysql_query($filter);
$filterres = mysql_query($filter);
您可以發佈'$ filterres' var的代碼嗎? – Nexerus
另請參閱[this](http://stackoverflow.com/questions/3899923/php-error-mysqli-num-rows-expects-parameter-1-to-be-mysqli-result-boolean-giv)或[this ](http://stackoverflow.com/questions/4988425/mysql-query-boolean-given) –
嘗試var_dump($ filterres)。如果它爲空或只是沒有查詢結果,則查詢失敗。也許WHERE語句可能會引發錯誤,請嘗試刪除它! – Anonymous