Hi,
I have come across an interesting problem... I have a photo gallery that shows photos in a 'seeded' random order each week.
I.e. Photos are ordered randomly, but stay that way for 1 week
I now want to go to an individual photo, and see the last 2 and next 2 photos in the random order described above.
My sql is:
$limit = 5;
$type = "1"; // gallery 1
$rand_seed = date("W"); // order by Week of year (e.g. 42nd week of 52)
$sql = "SELECT photo_id FROM yallery_photos JOIN yallery ON photo_yallery_id=yallery_id WHERE yallery_album='$type' ORDER BY RAND(".$rand_seed.") LIMIT $limit";
if (!($result=mysql_db_query(DB, "$sql"))) $this->mysql_msg($sql,mysql_error(),mysql_errno());
This does what its supposed to, get each Photo id randomly each week...
Now, how can I sort this list based on the Photo I am viewing?
E.g. I am on photo 22, and would like to get the last and next 5 photos in this gallery
how to do this when I am randomizing the results?
Thanks