472,958 Members | 2,202 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

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

62
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
Aug 31 '07 #1
3 2117
gregerly
192 Expert 100+
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
Aug 31 '07 #2
pbmods
5,821 Expert 4TB
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.
Aug 31 '07 #3
paitoon
62
ok the main script is here;
Expand|Select|Wrap|Line Numbers
  1. <?  //////////THis is the script that i put above the head doccument/////////
  2. $page=$_GET[page];
  3. if ($page=="") {
  4.         $page=1;
  5. }
  6. $each=20; // specify number of image per one page//
  7. ?>
  8.  
Expand|Select|Wrap|Line Numbers
  1. <?  ////////This part is in body
  2. $sql="select * from users where";
  3.     $check=0;
  4.  
  5.     if  ($sex<>"*") {
  6.  
  7.         $sql.=" sex='$sex' ";
  8.         $check=1;
  9.     }
  10.  
  11.     if ($lookfor<>"*") {
  12.         if ($check==1) {
  13.             $sql.=" AND lookfor='$lookfor' ";
  14.         } else {
  15.             $sql.=" lookfor='$lookfor' ";
  16.         }
  17.         $check=1;
  18.     }
  19.  
  20.  
  21.  
  22.  
  23.     $sql2="select * from users where sex='$sex'  or lookfor='$lookfor' province'";
  24.     $result2=mysql_db_query($dbname,$sql2);
  25.     $total=mysql_num_rows($result2);
  26.                 $totalpages=ceil($total/$each);
  27.     $goto = ($page-1)*$each;
  28.  
  29.  
  30.     $sql.=" order by username  limit $goto,$each";
  31.     $result=mysql_db_query($dbname,$sql);
  32.     while ($rs=mysql_fetch_array($result)) {
  33.         $username=$rs[username];
  34.         $password=$rs[password];
  35.         $userid=$rs[userid];
  36.  
  37.     ?>
  38.  
  39.  
  40.  
  41.  <?  ///////////////// And this is the last
  42.  
  43.     if ($totalpages>1) { 
  44.         echo "<B>หน้า $page</B><BR>";
  45.         for ($i=1;$i<=$totalpages;$i++) {
  46.                 echo "| <A HREF='search2.php?page=$i'>$i</A> ";
  47.         }
  48.     }
  49. ?>

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...what should i do ?
Thank you so much for the further help

Alex
Sep 4 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Petre Huile | last post by:
I have designed a site for a client, but they have hired an internet marketing person to incrase their search engine ranking and traffic. He wants to put extra-large fonts on every page which will...
0
by: Mark Goldin | last post by:
I am working on a search engine. An aspx page shows some data. The user will type something in and click a button to search. I want to create a server solution for the search engine. So the search...
11
by: ste | last post by:
Hi there, Further to my recent posts where I've received excellent help from Rik and Jerry, I've ended up with an image gallery on my website that displays images in a table, 3 images per row. ...
4
by: MDW | last post by:
Posted this on another board, but evidently it was off-topic there...hope you folks will be able to provide some guidance. I've been working on a Web site for a business (my first non-personal...
4
by: Ed Jay | last post by:
I generate a DHTML page (a medical report) with dynamically generated text based on user input (answers to questions). The page length changes dynamically. I desire that when the page is printed...
4
by: comp.lang.php | last post by:
'll try to explain this as clearly as possible, sorry if it's unclear. You have in your directory /foo 42 images You have in your database metadata for 30 out of those 42 images You have to...
1
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that...
4
by: ArizonaJohn | last post by:
Hello, The code below works great. The user enters a name into an HTML form, the code looks up a table with that name, and then that table is displayed. I am trying to use pagination with it,...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.