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? Quote 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. Quote 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 Quote 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) Quote 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? Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.