Codeigniter/PHP delete row after period of time
Is it possible to delete a SQL 开发者_如何学运维db row after a period of time?
ie. I have a row that has an expiration date and it needs to be deleted on that day?
If I'm displaying info to a user, is it better practice to just hide "expired" entries and keep the data?
Either way this looks like a job for cron. Just create a cron job that runs daily that either deletes or hides the rows that expire that day. I prefer to hide them for data retention purposes but deleting them might suit your application better. You'll know better then us.
I think you can always call it like this:
Afterwards you go to your cpanel to set a time interval that executes a script periodically.
精彩评论