Re: how to display photos of the day?
| From: | tedd | Date: | Tue, 29 Jan 2008 16:41:19 +0000 |
| Subject: | Re: how to display photos of the day? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268252@lists.php.net to get a copy of this message | ||
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