The Most Active and Friendliest
Affiliate Marketing Community Online!

“Adavice”/  “CPA

Problem with random results and pagination

virtuoso

New Member
affiliate
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.
 
You can do this by.......

Hi,

You can do this by storing the ID of results fetched in a session and on the next page in the query exclude these, repeat this when ever the user moves to the next page. But this is not a good approach if the database is huge as it will increase the script execution time as the user will move to the next page.

The other way is for every user create a temp table on the fly sort all the records in it, show the first set and then delete it so that when the user moves to the next page in the temp table the records already shown on the previous page are not there. Again script execution and server resources will be become a problem if the number of users accessing the site at one point of time are more and if the database is huge.

Cheers,

~Maneet
 
MI
Back