3

How Can I write a PHP script or MySQL script to do a repetitive task after a period of time? One example of this could be to delete the top row of a specific table in the database every 120 seconds.

4

1 回答 1

8

使用事件

CREATE EVENT delete_top_event
    ON SCHEDULE
      EVERY 2 MINUTE
    DO
      DELETE FROM your_table order by some_column desc limit 1;
于 2013-09-16T13:23:03.643 回答