开发者

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource [duplicate]

This question already has answers here: 开发者_如何学Go Closed 10 years ago.

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".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜