Question

I need help to cancel a process of deleting a row in mysql using PHP! The thing is that I want to delete inactive accounts if they have not been active before 24 hours!

How I delete now:

DELETE FROM members WHERE passkey_valid <= DATE_SUB(NOW(), INTERVAL 1 DAY);
Was it helpful?

Solution

Create a column called "validated" with "YES" as a value and upon deletion of others later on, use WHERE .... validated !='YES' as an example.

DELETE FROM members WHERE validated !='YES' 
AND passkey_valid <= DATE_SUB(NOW(), INTERVAL 1 DAY);

Your INSERT could resemble something like this:

$validated = "YES";

$query = "INSERT INTO members (validated,date) 
    VALUES ('$validated', NOW() )";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top