I am working on a listing site (www.togoenvogue.com) and need to set an auto deletion feature.

What I want is this. When the user wants to add a listing (job offer for example), he will need to select from a SELECT drop down how long he wants his message to be listed on the site. (field name can be "dropme")

For if he selects 1 month, the value would be 720 (hours).

Then I want to set an auto decrementation function that will reduce automatically DROPME value -1) every one hour.

So another function will automatically delete the message from the database when DROPME value is zero (something like DELETE FROM listingtable WHERE dropme ==0).

Any idea ?? Can somebody help me ???

Thank you in advance.


8 Years
Discussion Span
Last Post by R0bb0b

I would do this:
1. Make a "created" field for the item submitted that defaults to CURRENT_TIMESTAMP value. This will be the time that the record is submitted.
2. Make another field called "expires" and procedurally set it's value to the value of "created" + "DROPME".
3. Create a php or perl script that runs every hour through the crontab and either marks old records inactive (where "expires" <= NOW()) or just deletes them.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.