Jump to content

Pagination by 10-10 page link.


man12_patil3

Recommended Posts

  • 1 month later...

For the first link, put parameters the each link as follows:

 

show.php?min=1&max=10

show.php?min=11&max=20

show.php?min=21&max=30

show.php?min=31&max=40

show.php?min=41&max=50

 

Then in your script, when you fetch the data from the database or text file, ignore all that comes before min and after max values and show the not-ignored values on your website.

 

This means each time you click on a link it makes a new data query.

Link to comment
Share on other sites

  • 1 month later...

^ You don't need two parameters for each URL, you should do something like:

show.php?page=1

show.php?page=2

...etc

 

Then, with a bit of maths, calculate which records you need for each page on that. Something like:

 

$perpage = 10;
$page = $_GET['page'];

$min = ($page-1)*10;
$max = $min + $perpage;

That will give you min=0, max=10 for page 1; min=10, max=20 for page 2. Then simply use those numbers in your MySQL query, in the "limit" clause. Something like:

 

$sql = "SELECT * FROM mytable LIMIT $min, $max";

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.