I need some help with this one --
I have a database that members can look through.. it has a couple of thousand rows in it, it's not huge (yet)..
I want to offer non members a chance to view a random entry, and since I don't want them to just keep hitting the button few seconds, and scrolling through the entire database, I want to limit it to one new entry every hour
anyone know of a way to generate a seed that will only change every hour (and won't be the same tomorrow, at the same time) ???
right now, this is the code I use to pull a random entry from the DB
############### generate seed for random db #######
srand((double)microtime()*1000000);
$seed = rand(1, 5000);
# Just for my troubleshooting
print "random number $seed <br>";
#############query DB for the random entry #############
$entry = mysql_query("SELECT * FROM info ORDER BY RAND($seed) LIMIT 1");
$rentry = mysql_fetch_row($entry);
print $rentry[0];
The only other thing I can think to do is to store the seed in a table somewhere, along with when it was generated, and check to see if it needs to be updated when view is done...
Any thoughts ????
Thanks!!!!