James142 Posted June 21, 2011 Report 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
Tom Posted June 21, 2011 Report 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
James142 Posted June 21, 2011 Author Report 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
Moderators mark1million Posted June 22, 2011 Moderators Report Posted June 22, 2011 Go careful with DELETE * make sure you have a backup as there is no recovery. Quote
James142 Posted June 22, 2011 Author Report Posted June 22, 2011 Go careful with DELETE * make sure you have a backup as there is no recovery. Thanks Quote
Moderators Kyle Posted June 22, 2011 Moderators Report 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
James142 Posted June 22, 2011 Author Report 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
Moderators Kyle Posted June 22, 2011 Moderators Report Posted June 22, 2011 Yeah, I messed up of which query to go for, lol. 1 Quote
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.