Hallo.

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.

Kamaster

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.

-Andy

Or you could look into creating a trigger, which is the way I would go.