Hi,, I have a search engine pulling the results from a MYSQL database with pagination. THE PROBLEM: I need the results to come up random on all the pages after each search or whenever the page is refreshed without doubling. I can do it with one page but the problem is with more pages. I'll be very grateful if somebody can come up with any ideas as I cannot find a solution anywhere.
It shouldn't be hard if you think of it logically, what you have to understand are the parameters of LIMIT - first param is the offset, second param is the rows per page. Here's a little calculation of offset that I just thought up: function calculateOffset($pageNum, $rowsPerPage) { $tempOffset = $pageNum * $rowsPerPage; return ($tempOffset > $rowsPerPage) ? ceil($tempOffset-$rowsPerPage) : 0; } PHP: $pageNum is the current page number, which is usually page 1. This changes when you go to page 2 and so on.