I have a simple query that displays random results, however I'd like to be able to keep those same results for a 24 hour period per visitor so it doesn't randomize on every page refresh. Here's the query:
<?php
$rs1= mysql_query("
SELECT * FROM Table_1
ORDER BY RAND()
LIMIT 4
");
while ($row1= mysql_fetch_array($rs1)) { ?>
I gather I'll need to use the date somehow. I did figure out how to get a random number to show for 24 hours:
<?php
date_default_timezone_set('America/Los_Angeles');
mt_srand(date('Ymd'));
$number = mt_rand(50, 5000);
mt_srand(); //reset for other calls
echo $number;
?>
But I'm not sure how to make that work with my original query. Any ideas? Or should I be creating a cookie rather than trying to do it with only php? How would I make a cookie work with it?