Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- Check database value cron/php and change if true


rocknbil - 4:49 pm on Aug 21, 2010 (gmt 0)


Well, I'd do it in perl, but yeah, you should be able to set up a daily cron for that. :-)

First disable your 12 month ones.

Basically when someone enters an item into the database it is assigned a 'type' value of '1' (items are usually listed for 12 months).



update table set type=0 where approved=1 and date_add(posted_date, interval 12 month) <= curdate();

in the same script, now run the second command.

I would like to run a cron job - once a day to check that if the 'Featured date end' is less than today - change 'type' value back to '1'.


update table set type=1 where approved=1 and featured_date_end <= curdate();


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4190188.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com