[RESOLVED] Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
Results 1 to 3 of 3

Thread: [RESOLVED] Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

  1. #1
    Resident Preacher unitedintruth's Avatar
    Join Date
    Aug 2006
    Location
    Olympia, WA USA
    Posts
    44

    resolved [RESOLVED] Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

    I am getting the following error and can not figure out why:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/XXXXX/public_html/XXXXXXXXXX/newbie/editor/content/listContent.php on line 40

    Can anyone see a reason why, or what it means?(I have outined line 40 with the
    +++===+++
    so you would know what line it is, it is not in my code.)

    My code is below.


    PHP Code:
    <?php
    include_once("../common/dbConnection.php");
    ?>
    <?
    $initStartLimit 
    0;
    $limitPerPage 10;

    $startLimit $_REQUEST['startLimit'];
    $numberOfRows $_REQUEST['rows'];
    $sortBy $_REQUEST['sortBy'];
    $sortOrder $_REQUEST['sortOrder'];

    if (
    $startLimit=="")
    {
            
    $startLimit $initStartLimit;
    }

    if (
    $numberOfRows=="")
    {
            
    $numberOfRows $limitPerPage;
    }

    if (
    $sortOrder=="")
    {
            
    $sortOrder  "DESC";
    }
    if (
    $sortOrder == "DESC") { $newSortOrder "ASC"; } else  { $newSortOrder "DESC"; }
    $limitQuery " LIMIT ".$startLimit.",".$numberOfRows;
    $nextStartLimit $startLimit $limitPerPage;
    $previousStartLimit $startLimit $limitPerPage;

    if (
    $sortBy!="")
    {
            
    $orderByQuery " ORDER BY ".$sortBy." ".$sortOrder;
    }


    $sql "SELECT   * FROM content".$orderByQuery.$limitQuery;
    $result MYSQL_QUERY($sql);



    +++++++=================+++++++++
    $numberOfRows MYSQL_NUM_ROWS($result);
    +++++++=================+++++++++



    ?>
    <?
    if ($numberOfRows==0) {
    ?>
    Sorry. No records found !!
    <?
    }
    else if (
    $numberOfRows>0) {

        
    $i=0;
    ?>
    In His Service,
    Donnie Jade
    UnitedInTruth

  2. #2
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    13,986
    It probably means that MySQL was unable to parse/process your SQL statement as supplied. Try changing your mysql_query line to the following so that you get some debug info:
    PHP Code:
    $result MYSQL_QUERY($sql) or die('Query failed: ' mysql_error() . "<br />\n$sql"); 
    Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." ~ from Nation, by Terry Pratchett

    "But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because hes a better programmer now!" ~ http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html


    eBookworm.us

  3. #3
    Resident Preacher unitedintruth's Avatar
    Join Date
    Aug 2006
    Location
    Olympia, WA USA
    Posts
    44
    Big Thanks Dude, that did it just fine for me. Thanks again for the help.
    In His Service,
    Donnie Jade
    UnitedInTruth

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •