I want to delete data from a table after a time interval has been passed and fill it with NULL value. I basically want that data to get expired after a certain interval of time. Is there any way to do it using Php. database is in Mysql. Thanks.
+1
A:
You're looking for some kind of cronjob to run every minute.
Why do you want to fill in null
values? It would be best to have smallint(1)
field that you fill with 1 if the row is deleted. That way you'll always be able to retrieve 'deleted' data if necessary.
phidah
2010-01-12 06:22:32
I want that data to get expired after certain interval of time. i dont want to delete the entire row, just the data in that column against the user.
Parag
2010-01-12 10:33:34
A:
Use a TIMESTAMP DEFAULT CURRENT_TIMESTAMP
field to track how old the record is, and a cron job to delete old records.
Ignacio Vazquez-Abrams
2010-01-12 06:22:52
Hi, i am a beginner in php. Will you please explain it to me by using a sample code and how it works?
Parag
2010-01-12 10:34:22