LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-23-2005, 08:25 PM   #1
jojojo
Member
 
Registered: Feb 2005
Location: Kuala Lumpur, Malaysia
Distribution: Fedora Core 5
Posts: 121

Rep: Reputation: 15
PHP paging problem


How do you pass a search string in paging???

Hello, my name is johan. Right now i am developing a
system using PHP
and MySQL. I have a paging problem. The paging works
when i want to
display all the person from all countries BUT it
does'nt work when i
search for a particular person from a certain
countries. My problem
is when i search for a participant from country
Canada, the first
page will display correctly all the person from
country Canada ONLY
in Page2. But when i click on the link "Previous",
"Next", "Page2,
Page3......", it will display all the person from
all countries. Is
it because i did not carry the variable of what i search for to
other pages? Do you
know what is causing the problems?

Eg. I have 2 pages.

Page1 is the search form
Page2 is display the paging of my search results.


Does anybody have a sample code on how to pass a search variable in the link to different pages????

This is my query:

$query = "SELECT * FROM person, tablecountry, tablecourse, course WHERE Name LIKE '$name1%' AND FamilyName LIKE '$name2%' AND Year attended LIKE '$tahun%' AND Country LIKE '$country%'"
. " AND person.KodCountry=tablecountry.KodCountry AND person.IDPerson=course.IDPerson AND course.KodCourse=tablecourse.KodCourse order by Name ";
$result = mysql_query($query);

echo "<a href=\"searchperson.php? WHAT SHOULD I INSERT HERE?????">Page$i</a>";
 
Old 02-24-2005, 01:13 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
If you use "searchperson.php?page=2&perpage=10" you can then add a LIMIT clause to the sql statement and use the given values. You could hardset "perpage" but it is nice to give people some choice when viewing lists like this.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Paging data from XML with PHP Boby Programming 1 03-23-2005 10:57 AM
PHP paging problem jojojo Linux - Newbie 2 02-23-2005 12:49 AM
New to PHP and Postgressql. Is this a PHP problem or a sql problem. Please help sendas4 Linux - General 2 11-05-2004 02:54 PM
Apache php index.php problem neurotic Linux - Software 3 11-18-2003 07:02 PM
virtual memory paging problem on install j_hart Linux - Software 0 10-13-2003 02:52 AM


All times are GMT -5. The time now is 10:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration