Page 1 of 1

Link to record number

Posted: Mon Sep 22, 2003 2:47 pm
by packito
Hey everybody!
I don't know how to put this question...

I bet everybody has noticed that when we search for something on the internet, using google or other search machine, we can see at the bottom of each search result page something like this

[1] [2] [3]... next | previous

where each number is a link to a specific page of the search's recordset. Now, I've already done the "next" and "previous" links, but can anyone give me a tip on how to implement links using the numbers?

Thanks!

PS: i was not very clear, but i hope you understand me... :?

Posted: Tue Sep 23, 2003 12:55 pm
by McGruff
Get the total num of rows and then calculate the total number of pages with

Code: Select all

<?php
$total_pages = ceil($total_rows/$max_items_per_page)
?>
Now you can loop through $total pages building up a 1 | 2 | 3 type link.

Posted: Tue Sep 23, 2003 3:09 pm
by packito
Eheh, i solved the problem just few minutes after i wrote this topic.
And yes, I used the same solution proposed by McGruff.

Thanks for the tip anyway, McGruff! :)