|
|||||||
| SQL For all Structured Query Language, and general database questions. |
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Automatic deletion of rows, timestamps
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) |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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........
|
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
|||
|
|||
|
I'm using MySQL.........
Windows 7 |
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|