我花了數小時試圖遵循編碼器的所有偉大的建議,試圖解決這個問題。我知道這是50個其他帖子的副本,但無法找到足夠接近我的代碼來修復它。我是PHP新手,並且在無法更新的網站上有一箇舊的電子商務購物車。請不要因爲我的無知而激怒我。有人可以給我關於如何解決這個問題的確切說明。提前致謝!沒有足夠的智能來解決mysql_fetch_array()期望參數1
我剛剛直接從文件複製代碼。我沒有添加所有的@。
錯誤:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/xxx /public_html/vsadmin/inc/mod/text.php on line 18
從test.php的
<?php
$cat = @$_GET['cat']; // Current Category ID
if(trim(@$_GET['cat'])!='') $theid = unstripslashes(@$_GET['cat']);
if(@$explicitid!='' && is_numeric(@$explicitid))
[email protected]$explicitid;
elseif(@$usecategoryname && $theid!=''){
$sSQL = 'SELECT sectionID FROM sections WHERE '.getlangid('sectionName',256)."='".escape_string($theid)."'";
$result = mysql_query($sSQL) or print(mysql_error());
if($rs=mysql_fetch_assoc($result)){ $catname=$theid; $theid=$rs['sectionID']; }
mysql_free_result($result);
}
$cat = $theid;
$queryrank="SELECT * from sections WHERE sectionID= '" . $cat . "' ";
$resultrank=mysql_query($queryrank);
?>
<?php
while ($sSQL =mysql_fetch_array ($resultrank))//<< line 18
{
$text = $sSQL['cattext'];
$html = $sSQL['cathtml'];
$optiom = $sSQL['catoption'];
if($sSQL['catoption']==1) {print "$text ";}
else print "$html";
}
?>
你在哪裏添加了數據庫連接? – Jenz
首先,停下所有'@'。你不想錯誤抑制!抑制錯誤正是使你無法弄清楚什麼是錯的! – deceze
也是你的第18行.. – Jenz