Wondering if its possible to have a file running and checking if a value in database/row

StackOverflow https://stackoverflow.com/questions/21751746

  •  11-10-2022
  •  | 
  •  

Question

Basically, If a value in Row is same for 3 days I want to remove the column, like if someone hasn't verified their account remove the account to save space.

Is there a way to make a script for this? If so can someone help me make it?

Pas de solution correcte

Autres conseils

Have a column like

modified timestamp default current_timestamp on update current_timestamp

in your table. Then write a query to delete entries of the table and execute it via event scheduler.

You can setup a cron job to run every day and execute this query on the database:

DELETE FROM table WHERE insert_date BETWEEN DATE_SUB(NOW(), INTERVAL 3 DAY) AND NOW();

Note: similar problem here.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top