Unanswered: A better way than this? (next / previous)
I think it's called 'database paging' in other words limiting the results to a specified # per page and dynamically creating next/previous links accordingly.
I used this on a site i created a wee while ago and accomplished it by using SQL LIMIT function
$page = 1;
$sqlNum = "SELECT stuff
WHERE this = that;
$resultNum = mysql_query($sqlNum);
$numRows = mysql_num_rows($resultNum);
$perPage = 6;
$offset = ($page-1)*$perPage;
$sql = "SELECT stuff
WHERE this = that LIMIT $offset,$perPage";
This means that you have to run 2 queries instead of 1. It also means that it carries out the query on each page.
It would be better if it only had the main query which iw carries out once and then somehow limits the actual output and spreads it accross the pages, perhaps some way of putting the results into arrary or caching etc.
So that It knows whether there needs to be a 'next' page or not
I can pass the total number which i get in thr 1st query through the querystring to the next and previous pages which means that 1st query only needs to be carried out on the first page. This is a bit of an improvement i guess.
I thought putting the results into a session could cause a performence problem due the possible size of the result set?