Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-23-2005, 08:25 PM   #1
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
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
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.


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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:14 PM.

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