At 6:33 PM +0800 1/29/08, jeffry s wrote:
sorry if this question sound stupid.
i need a good, simple and efficient function to display lets say photo of
the day.
i have a mysql table contain data about 1000 rows. i want to display any of
the photos randomly
and it is fixed for one day.
anyone know how to write the function that return a fixed table id for the
day?
jeffry:
Simple enough:.
1. Figure out what day it is.
2. Pull a random image from the database if that date has changed.
If it were me, I would create a simple field in the database that
would have todays date (day of the year) in it.
Then my script would check date(z) with that field. If the value is
different, then I would replace that value with the new value and
then change the picture accordingly by using the rand() function.
Cheers,
tedd
PS: date(z) produces the day of the year (1-365)
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php