James142 Posted June 21, 2011 Report Share Posted June 21, 2011 Hello. Would anyone here know how to do delete a row from a MySQL database after a certain date? so lets say someone puts in 11/12/2012 in a form text-box and is sent to a table in a MySQL database, when the date 11/12/2012 comes, the row in the MySQL database will delete? Any help will be much appreciated! Regards, James Quote Link to comment Share on other sites More sharing options...
Tom Posted June 21, 2011 Report Share Posted June 21, 2011 You'll need a cron job to run the script daily, and the mysql should be something like: DELETE * FROM table WHERE date <= NOW() Hopefully... Quote Link to comment Share on other sites More sharing options...
James142 Posted June 21, 2011 Author Report Share Posted June 21, 2011 You'll need a cron job to run the script daily, and the mysql should be something like: DELETE * FROM table WHERE date <= NOW() Hopefully... Ok, I shall have a go with that tomorrow. Thanks Tom Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted June 22, 2011 Moderators Report Share Posted June 22, 2011 Go careful with DELETE * make sure you have a backup as there is no recovery. Quote Link to comment Share on other sites More sharing options...
James142 Posted June 22, 2011 Author Report Share Posted June 22, 2011 Go careful with DELETE * make sure you have a backup as there is no recovery. Thanks Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted June 22, 2011 Moderators Report Share Posted June 22, 2011 Indeeded! Happened to me once when I was creating a TypeRating and I made a mistake for deleting the pilot's typerating, it deleted the pilot. Quote Link to comment Share on other sites More sharing options...
James142 Posted June 22, 2011 Author Report Share Posted June 22, 2011 Indeeded! Happened to me once when I was creating a TypeRating and I made a mistake for deleting the pilot's typerating, it deleted the pilot. I don't know why but that just made me laugh 1 Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted June 22, 2011 Moderators Report Share Posted June 22, 2011 Yeah, I messed up of which query to go for, lol. 1 Quote Link to comment 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.