I’m trying to setup a sql db where users must confirm their email address. I’m wondering if there is a way to auto delete the users in the sql db that attempted to register (submit their info) but not confirm their email address after x amount of mins.
the script that i have written inserts their info straight into the db and then updates a column on the db to “ACTIVE” once the users has confirmed, so i don’t insert the data once they have activated, but before with a status of “NON_ACTIVE”. Then when they confirm their email address, that status turns to “ACTIVE”.
so if a users submits their info, but fails to confirm their email address, their details are still in the DB. I need something that will auto delete a row with the status “NON_ACTIVE” after x minutes to when they submitted their info. I have another column in the DB with their exact submit time and date.
any ideas?
I would write a statement similar to @Lars:
but you don’t need to have a cron job or a trigger for this. Just put it in one of the PHP pages your users access (perhaps the Login or Register page?). It may even be set not to run every time but say, once for every hundred Logins if you don’t mind some records get deleted a few seconds or minutes later.