Click to See Complete Forum and Search --> : Automatic deletion of rows, timestamps


Charybdis
03-08-2010, 09:58 PM
Im fairly new to SQL code to bear that in mind.

Anyways does anyone know how to make it so when someone makes a new row in my table (aka: someone creates an account), after 24 hours if a field in that row: status is not set to: "activated", then the row gets deleted? (aka: the account gets deleted if its not activated after 24 hours)

maneetpuri
03-09-2010, 06:23 AM
Hi,

You will have to write a script, which should be executed automatically after fixed intervals of time and will pick the records where the time difference between the current time and the time at which the record was inserted is more than 24 hours, simply delete those records.

Hope this helps.

Cheers,

~Maneet

Charybdis
03-09-2010, 01:02 PM
What would I write it in? How would I write it? I wouldn't know how to make it run automatically. I think I need more detail than that........

ssystems
03-09-2010, 06:29 PM
What database you are using and what platform. Linux environment have cron jobs which is equivalent to win sched jobs. There is also agent jobs in MSSQL you can use.

Charybdis
03-09-2010, 06:33 PM
I'm using MySQL.........
Windows 7

maneetpuri
03-10-2010, 06:25 AM
Hi,

You can install PHP on your machine, and develop a script in PHP to do that. And since you are using Windows 7 as the opertaing system you will have to setup windows scheduled tasks to make this script to run at fixed intervals of time.

Cheers,

~Maneet

Charybdis
03-10-2010, 12:36 PM
Okay thanks!
Can you look at this topic:
http://www.webdeveloper.com/forum/showthread.php?t=226063