search

Home  >  Q&A  >  body text

How can php+mysql automatically insert a piece of data into the database at 0 o'clock every day?

Suppose my database has a table with two fields

What I want to achieve is to automatically insert a piece of data into the database at 24:00 every day
For example, it turns out that
id=1
pv=0

I want to automatically insert one at 0 o'clock every day
id=2
pv=0

In another day,

will automatically insert one
id=3
pv=0

In another day,

will automatically insert one
id=4
pv=0

....

Does anyone understand this?

仅有的幸福仅有的幸福2712 days ago1360

reply all(3)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-06-23 09:14:06

    Method 1: Use mysql event to create a scheduled task

    Reference: https://blog.codefun.cn/blog/...

    Method 2: Use the scheduled task that comes with the operating system to execute the php script regularly

    Method 3: Use nodejs or java or others which all come with scheduled tasks

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-06-23 09:14:06

    crontab

    reply
    0
  • 天蓬老师

    天蓬老师2017-06-23 09:14:06

    linux scheduled task crontab

    reply
    0
  • Cancelreply