473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 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 2127
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.