|
Hi there. Sorry for not being more detailed in my response but I have attached a function that I wrote literally yesterday for paging through results.
You call the function as follows;
$paging = create_paging($no_ofresults, $record_no, $record_limit, $page);
The function returns an array in the form of a <ul><li> list in a <div class="pages">.
In order to get the variables for the function you must do the following;
1. $no_ofresults is the total results in your table. Just do a query as "SELECT COUNT(id) AS total FROM... etc."
2. $record_no - this is the current record number you are browsing from. If you are on your first page then this is 0. Second page, this is 5 etc. This should be passed via the query string and retrieved using the $_GET array. So you page should look like this - 'my-page.php?record_no=0'
3. $record_limit - this is how many results you want per page (e.g. 5)
4. $page - this is the name of the current page you are on
I hope to god someone else has something a little simpler but I've found that paging through results isn't quick or easy. It requires a lot of maths and lots of trial and error.
I hope that's of some use
|