Jump to content


Paginating issue

  • Please log in to reply
2 replies to this topic

#1 netfrugal

  • Members
  • PipPip
  • Member
  • 26 posts

Posted 09 October 2006 - 06:09 PM

I have 2 pages.  Form.php  & Paginate.php

I enter the username into the form.php and it sends me over to paginate.php where it looks for records with the username I chose.

I can see all the results on Paginate.php, but if I click to go to the next page (paginate.php?page=2)  everything goes blank!

Do the search parameters get lost after one page? 

Any help would be appreciated!


#2 mendoz

  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts

Posted 09 October 2006 - 07:49 PM

If you post your code it'll be easier to help

#3 HuggieBear

  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 10 October 2006 - 08:45 AM

Do the search parameters get lost after one page? 

Yes, unless you save them in a session variable, or pass them in the URL along with the page number (I think the second is probably preferable in your case).

Say your form submits with a URL like this:

Then the links in your paginate page should look a little like this:
echo <<<HTML
<a href="paginate.php?cat={$_GET['cat']}&sort={$_GET['sort']}&page={$i}">$i</a>

This would take you to the following url:

I've used heredoc syntax to escape the HTML above, if you're unaware of this, look it up here: heredoc

Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users