spikypunker Posted February 24, 2009 Share Posted February 24, 2009 Hey guys Just wanna get some thoughts on how to approach a small problem. I've developed a section on my website where i can enter gigs in an entry from and they get displayed on 5 different pages, (5 different cities) When you enter the gig or event you have to enter a date for it, this is in the standard mysql date format yyyy-mm-dd. I then display the listings in date ascending order etc. Is there a way of building a routine that deletes from the mysql db, any entires older than the current date? Either that or make it not pull entries from the db that are older than the current date. IE can the DATE fromat of a mysql db be compared to the TIME function in php? Here is the code for pulling the entries, very simple: $query = "SELECT * FROM events WHERE town='colchester' ORDER BY date ASC"; Quote Link to comment https://forums.phpfreaks.com/topic/146686-deleting-old-database-entires/ Share on other sites More sharing options...
sasa Posted February 24, 2009 Share Posted February 24, 2009 $query = "DELETE FROM events WHERE town='colchester' AND date < $some_date"; Quote Link to comment https://forums.phpfreaks.com/topic/146686-deleting-old-database-entires/#findComment-770100 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.