Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show a different random record each click next 1

Status
Not open for further replies.

anorakgirl

Programmer
Jun 5, 2001
103
GB
hi,
wondered if anyone had any suggestions for the best way to approach this:
i have an msaccess table containing a number of records. when my asp page loads, i want to show a random record from the table (i can do this). then when the user clicks "next" the page reloads and a different random record is displayed. each time next is clicked, a new random record should be displayed, but not repeating any of the records displayed previously during the session (obviously until all the records have been displayed).
i'm not sure what the best approach would be, any suggestions?

thanks! ~ ~
 

You'd probably need to store which records your users have seen. Maybe store the pk of the records in a session var or cookie (depending on persistence), then use a NOT IN in your SQL statement with these primary keys.

Do the users login to your site? If so, maybe store the info in the database.

Good luck!
 
hi,
that was the best idea i could come up with too - was a bit worried about the performance implications of a massive not in clause, but i've given it a go and it seems to be ok
(users don't log in so i can't use that option really)

thanks for the help! ~ ~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top