A couple of thoughts:

As you want to cycle through the list rather than randomly (with repetition)
picking from the list, have you considered storing the last CD shown details
in the DB?

If each CD has a sequential ID then each week (or day) you increment the
number which will determine what CD is shown. If the incremented CD id
exceeds the highest id in the DB, restart back at the first id.

You could also include a column (or two) in the CD info table to record when
it was last displayed and check that this is > 29 days ago.

What about cookies? Each visitor could then have their own 'cycle' through
the list.

HTH

Graham

-----Original Message-----
From: I.A. Gray [mailto:[EMAIL PROTECTED]
Sent: 01 October 2004 07:34
To: [EMAIL PROTECTED]
Subject: [PHP] How do I produce a random database query for each day or
week?


Hi,

My brain is working very slowly this morning (maybe that is because of
having 5hrs sleep...)
Could someone help me with this problem.

I would like to show a different CD with information on it, on the home page
each week- a kind of 'recording of the week' and I would also like to have
on the same page something that changes every day.

The recordings are in a MYSQL database and I would like all of them (there
are 29 at present) to be shown over how ever long it would take to get
through them (in this case 29 weeks) and then once they have all been shown
this would then repeat.  I would like them to be shown in a random order and
make sure that the recording hasn't been shown within the 29.  The same goes
for the other project which uses a mysql database which I would like to
rotate daily (in this case there are 103 items)

Obviously if I use PHP random functions this will always return a random
number, but how do I produce a random number which relates to the day or
week of the year?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to