I have a requirement to delete a row after 24 hours from its creation time. Is there a way in PHP/MySQL to do this?
The time must count from the insertion time of the row and after 24 hours it must be deleted. Although we can write cron to check for every minute, when there are not many rows added cron will run without use. Is there some other mechanism to do it?
If you have your mySQL version >= 5.1.6 , there is a good feature intended for use in such cases – mySQL events.
Here is an example of usage – http://phpmaster.com/working-with-mysql-events/