PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Greetings PHP Technorati. I hope all is well. I come to you seeking more guidance on the subject of using a cron job to delete a mysql field entry 15 minutes after the entry is entered by the user. I haven't done this before, but should I use some sort of time expiration php script or leave it to the mysql cron job to run every 15 minutes, deleting new entries? Any thoughts on this matter as always is greatly appreciated.
You can use a cron job to run a PHP script or use MySQL Event Scheduler (if you have MySQL 5.1 or greater).
I would recommend running the delete job every minute, given what you described. That will make sure that no matter when the entry was created -- it will be delete 15 minutes later. If you run it every 15 minutes then records will be deleted between 15 and 30 minutes later.
Yes , the information is at best meant to be temporary for the user of the application. Hence, as a security measure, records are not to be backed up and must be deleted within a set time. Besides, how do you hack something that is not stored in the db long enough for you to get your hands on it?
Sun Tsu: Art of War- Eliminate your enemy's options.