Results 1 to 26 of 26

Thread: mysql database problem

Threaded View

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    mysql database problem

    I recently changed servers, and now when I try to access my guestbook, I keep getting this error:


    Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/mendhak/public_html/guestbook/index.php on line 51


    For some reason, mysql_numrows, is not... valid/recognized???
    Here's the code:

    PHP Code:
    <?php
    global $offset// the string will be in the URL, say index.php?offset=9
    if($offset==OR $offset==""){
    $offset=0;
    }


    $dbh=mysql_connect("localhost""mendhak_hello""hello") or die ('I cannot connect to the database because: ' mysql_error());
    mysql_select_db("mendhak_thewebsite"); 

    $displayperpage 5//set this variable to the number of records you want per page.

    $sqloffset=$offset*$displayperpage;




    $query="SELECT * FROM guestbook ORDER BY id DESC LIMIT $sqloffset,$displayperpage";
    $countquery="SELECT COUNT(*) FROM guestbook";

    $result=mysql_query($query);

    $pagecount=mysql_query($countquery);
    $rowsonthispage=mysql_numrows($result);
    //[b][color=black]THIS IS LINE 51[/color][/b]



    $tempcount mysql_fetch_row($pagecount);

    $num $tempcount[0];   //now we have total records
    Last edited by mendhak; Apr 14th, 2003 at 11:40 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width