Josh Woelfel
Josh Woelfel

Reputation: 1969

Empty database table at certain times

I have a database table that I need to empty every 24 hours, or whatever time that I set it to. I don't want the table deleted, just emptied. I'm wondering what the best method would be to do this using PHP? Really appreciate any direction you can provide for me.

Upvotes: 1

Views: 73

Answers (1)

Vijaya Pandey
Vijaya Pandey

Reputation: 4282

You can do this using Event Scheduler.

Query can be something like this:

DELETE FROM your_table WHERE time < NOW() - INTERVAL 24 HOUR

Upvotes: 1

Related Questions