svgmx5 Posted July 6, 2010 Share Posted July 6, 2010 i'm fairly new to using mysql/sql I've used it before with php and what now, but never really on its own. Which is why i'm curious to know if there is a way to automatically delete rows from my table. Say for example... i have a table that holds comments, and i want that table to delete all comments that are older than 30 days from the current date. Instead of having to do it manually or through out a php script, i was wondering if i could do it through the database? Link to comment https://forums.phpfreaks.com/topic/206853-deleting-rows-from-database-automatically/ Share on other sites More sharing options...
trq Posted July 6, 2010 Share Posted July 6, 2010 In 5.5 there is an event scheduler (see http://dev.mysql.com/doc/refman/5.5/en/events.html) otherwise, you'll need to use your OS's scheduler to schedule a job for execution. Link to comment https://forums.phpfreaks.com/topic/206853-deleting-rows-from-database-automatically/#findComment-1081767 Share on other sites More sharing options...
svgmx5 Posted July 6, 2010 Author Share Posted July 6, 2010 thanks, i wasn't sure if that was possible, but i guess i'll just use that or use a php script to delete them Link to comment https://forums.phpfreaks.com/topic/206853-deleting-rows-from-database-automatically/#findComment-1081769 Share on other sites More sharing options...
Mchl Posted July 6, 2010 Share Posted July 6, 2010 The scheduler is available since 5.1 (and works great) Link to comment https://forums.phpfreaks.com/topic/206853-deleting-rows-from-database-automatically/#findComment-1081779 Share on other sites More sharing options...
fenway Posted July 6, 2010 Share Posted July 6, 2010 The scheduler is available since 5.1 (and works great) Really? No strange bugs? Link to comment https://forums.phpfreaks.com/topic/206853-deleting-rows-from-database-automatically/#findComment-1081887 Share on other sites More sharing options...
Mchl Posted July 6, 2010 Share Posted July 6, 2010 Didn't notice any. Link to comment https://forums.phpfreaks.com/topic/206853-deleting-rows-from-database-automatically/#findComment-1081895 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.