Search engine pagination shows a blank page on every page except page 1

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paitoon
    New Member
    • Aug 2007
    • 62

    Search engine pagination shows a blank page on every page except page 1

    Hi,
    In my site i set a serach engine page.Which customer could put key word and find the user name in database,
    I set in one page will show 40 people. If over 40 the page will set to be other next page..
    Well, everything work fine at the 1st page, But when i click on the 2nd page or next page to see the result ...those next page is empty.Seem like the page knows how many record in that keyword but can not show the record in next page...then evrything is empty on next page...
    I got stress too much, I never have problem about this if i specify only one name one result....
    But this i use trimm to explode the key word i dont know where to fix it

    Alex
  • gregerly
    Recognized Expert New Member
    • Sep 2006
    • 192

    #2
    Originally posted by paitoon
    Hi,
    In my site i set a serach engine page.Which customer could put key word and find the user name in database,
    I set in one page will show 40 people. If over 40 the page will set to be other next page..
    Well, everything work fine at the 1st page, But when i click on the 2nd page or next page to see the result ...those next page is empty.Seem like the page knows how many record in that keyword but can not show the record in next page...then evrything is empty on next page...
    I got stress too much, I never have problem about this if i specify only one name one result....
    But this i use trimm to explode the key word i dont know where to fix it

    Alex
    I have a feeling that your not properly using SQL's LIMIT. Without seeing any of your code it's hard to tell, please post some code and we can probably help you further.

    Greg

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, Paitoon.

      Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

      If you're getting a blank page, your script is probably generating an error. Check out this article to find out what is going on.

      Comment

      • paitoon
        New Member
        • Aug 2007
        • 62

        #4
        ok the main script is here;
        [code=php]
        <? //////////THis is the script that i put above the head doccument/////////
        $page=$_GET[page];
        if ($page=="") {
        $page=1;
        }
        $each=20; // specify number of image per one page//
        ?>
        [/code]
        [code=php]
        <? ////////This part is in body
        $sql="select * from users where";
        $check=0;

        if ($sex<>"*") {

        $sql.=" sex='$sex' ";
        $check=1;
        }

        if ($lookfor<>"*") {
        if ($check==1) {
        $sql.=" AND lookfor='$lookf or' ";
        } else {
        $sql.=" lookfor='$lookf or' ";
        }
        $check=1;
        }




        $sql2="select * from users where sex='$sex' or lookfor='$lookf or' province'";
        $result2=mysql_ db_query($dbnam e,$sql2);
        $total=mysql_nu m_rows($result2 );
        $totalpages=cei l($total/$each);
        $goto = ($page-1)*$each;


        $sql.=" order by username limit $goto,$each";
        $result=mysql_d b_query($dbname ,$sql);
        while ($rs=mysql_fetc h_array($result )) {
        $username=$rs[username];
        $password=$rs[password];
        $userid=$rs[userid];

        ?>



        <? ///////////////// And this is the last

        if ($totalpages>1) {
        echo "<B>หน้า $page</B><BR>";
        for ($i=1;$i<=$tota lpages;$i++) {
        echo "| <A HREF='search2.p hp?page=$i'>$i</A> ";
        }
        }
        ?>[/code]


        everything work correctly,I set it to show 10 results each page..But when i click on the link to page number 2 it show wrong....i got all every information in database even i am not searching for it...But why the first page is work correctly...wha t should i do ?
        Thank you so much for the further help

        Alex
        Last edited by pbmods; Sep 4 '07, 01:42 PM. Reason: Added CODE Tags

        Comment

        Working...