poleposters Posted April 11, 2008 Share Posted April 11, 2008 Hi I want to create a script that deletes entries that are older than two weeks old. Although I'm not sure how to structure queries relating to a date/time field. My table is already set up to include a date/time field and works fine. I just don't know how to tell the database to delete records than are older than xx/xx/xx Link to comment https://forums.phpfreaks.com/topic/100604-using-datetime-to-manipulate-database/ Share on other sites More sharing options...
zenag Posted April 11, 2008 Share Posted April 11, 2008 can u show database struct Link to comment https://forums.phpfreaks.com/topic/100604-using-datetime-to-manipulate-database/#findComment-514544 Share on other sites More sharing options...
paul2463 Posted April 11, 2008 Share Posted April 11, 2008 $query = "DELETE FROM tablename WHERE datetimeColumn < DATE_ADD(NOW(), INTERVAL -14 DAY)"; I think !! Link to comment https://forums.phpfreaks.com/topic/100604-using-datetime-to-manipulate-database/#findComment-514550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.