9911782 Posted May 2, 2006 Share Posted May 2, 2006 Hi AllIm very new in php. Can somebody send me the link of website where I could get the tutorial that will help me to understand on how to code the Auto-delete code in php?Your help is highly appreciated.thank you :) Quote Link to comment https://forums.phpfreaks.com/topic/8871-auto-delete-code/ Share on other sites More sharing options...
wildteen88 Posted May 2, 2006 Share Posted May 2, 2006 What do you mean by auto-delete code you explain a but more about what you are trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/8871-auto-delete-code/#findComment-32547 Share on other sites More sharing options...
9911782 Posted May 2, 2006 Author Share Posted May 2, 2006 [!--quoteo(post=370487:date=May 2 2006, 01:15 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 2 2006, 01:15 AM) [snapback]370487[/snapback][/div][div class=\'quotemain\'][!--quotec--]What do you mean by auto-delete code you explain a but more about what you are trying to do.[/quote]I have a events table that stores all the event per school. They way me to have a facility that will provide for an auto-delete in respect of advertisement of events exceeding 3 months publication time.So, I need someone to help with tutorial or a code to do this.I hope Im clear. Quote Link to comment https://forums.phpfreaks.com/topic/8871-auto-delete-code/#findComment-32561 Share on other sites More sharing options...
tjhilder Posted May 2, 2006 Share Posted May 2, 2006 [!--quoteo(post=370501:date=May 2 2006, 10:20 AM:name=9911782)--][div class=\'quotetop\']QUOTE(9911782 @ May 2 2006, 10:20 AM) [snapback]370501[/snapback][/div][div class=\'quotemain\'][!--quotec--]I have a events table that stores all the event per school.[/quote]I'm thinking you mean a mysql table? if so possibly a query like this..[code]$autodelete_date = date('Y-m-d H:i:s');$autodelete_query = "DELETE FROM events_table WHERE (date <= '" . $autodelete_date . "')"; // deletes anything before now.if (!$autodelete_result = mysql_query($autodelete_query)) // if problem, display error.{ echo "nothing deleted because : " . mysql_error() . " the query was: " . $autodelete_query;}[/code]date's column would be like this in mysql[code]`date` datetime NOT NULL,[/code]this is untested btw, maybe someone might have a better idea or maybe an edit of that code, i dunno. but it should work if you have the table set right.hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/8871-auto-delete-code/#findComment-32585 Share on other sites More sharing options...
9911782 Posted July 24, 2006 Author Share Posted July 24, 2006 Hithank you for your help.Ur example is working for me, its exaclty what I've been looking for...thanka milion :) Quote Link to comment https://forums.phpfreaks.com/topic/8871-auto-delete-code/#findComment-62705 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.