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);
有帮助吗?

解决方案

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() )";
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top