Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource [duplicate]
Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
This is the part of my script that I'm having issues with. All of the following queries work and the results display properly on the page except for $sType="rating". This the one that causes the warning to appear in place of the data. I've tried running the specific query on the server and it returns properly. It only gives me an error when I use it on the webpage. Does anyone have any idea what the issue might be?
$sType=$_GET["sort"];
$newQuery;
if($sType=="lowHigh")
{
$newQuery = mysql_query("SELECT * FROM Products ORDER BY SalePrice");
}
else if($sType=="highLow")
{
$newQuery = mysql_query("SELECT * FROM Products ORDER BY SalePrice DESC");
}
else if($sTpye=="rating")
{
$newQuery = mysql_query("SELECT * FROM Products ORDER BY Rating DESC, NumRatings DESC") or die(mysql_error());
}
else if($sType=="mostReviews")
{
$newQuery = mysql_query("SELECT * FROM Products ORDER BY NumRatings DESC");
}
$p1=mysql_fetch_array($newQuery);
$p2=mysql_fetch_array($newQuery);
$p3=mysql_fetch_array($newQuery);
$p4=mysql_fetch_array($newQuery);
$p5=mysql_fetch_array($newQuery);
$p6=mysql_fetch_array($newQuery);
$p7=mysql_fetch_array($newQuery);
$p8=mysql_fetch_array($newQuery);
You've mistyped $sType
in your check for "rating".
精彩评论