Jump to content

Auto-delete code


9911782

Recommended Posts

Hi All

Im 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 :)
Link to comment
Share on other sites

[!--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.
Link to comment
Share on other sites

[!--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.
Link to comment
Share on other sites

  • 2 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.