Hi!
I have a randomized result set coming off my table with
$sql='SELECT * [TABLE] ORDER BY RAND()';
$result=mysql_query($sql);
Fine.
There are, say 30 records in the result, and I want to group these in groups of 10 with a next and previous page being shown as appropriate.
I can do the 10 at a time stuff, but how do I do it without requerying the data (which messes up the randomizing)?
I have:
$startcounter=0;
$endcounter=10;
for ($counter = $startcounter; $counter < $endcounter; $counter++) {
show the stuff
}
Then
if ($counter<$datarows)
{
?>
<a href="?nextcounter=$counter">next</a>
<?php
}
and it loops back round to set
$startcounter=$nextcounter
and a bit of stuff to set $endcounter to 10 or the last record, whatever is appropriate.
PROBLEM
The problem is I can't requery the data, since the set is randomized and I would get a re-randomized set. So, how do I repeat the whole thing whilst keeping the values of the result set, i.e. without doing the query again?
Thanks in advance anyone!
Regards
Elizabeth