Can someone point me to a tutorial to help me learn how to do this? When I insert a row into the DB I want to put a date on it that is 90 days in advance. I want that record to be deleted on that date. I've been looking at time stamps and everything like that, but I want to make sure there isn't an easier way before I stumble through setting up a nightly cron to remove all expired entries. Thanks for a shove in the right direction!
ts with a default of now, then a cron job for things over 90 days old seems to make sense to me. Pretty easy really, can't think of an easier way off hand... so seem the right path already that you are on. BTW, no need for php to do this. Just pipe the sql into the mysql command. Its like a 5 minute job and two lines of code (one to add the default now to the table, and the other to expire them).
wow that was way easier the I thought. Used NOW() to put today's date in the database and $expired = date("Y-m-d", strtotime("-90 days")); $query = "DELETE FROM history WHERE date < '$expired'"; mysql_query($query); PHP: To make it go away. A cron job every night at midnight and we're set. My missing link was NOW and the php DATE functions, all the different date and time formats were confusing me, but it's smarter then I thought, since there's a field type called DATE. Thanks for reassuring me!