how to run an Insert query in a time interval with mysql

Asked

Viewed 52 times

0

I need to run an Insert query every day at 23:59 with Mysql, without having to access the system

INSERT INTO TB_ESTOQUE_DIARIA (ID_PRODUTO, ESTOQUE, DATA) 
SELECT ID, ESTOQUE_ATUAL, CURRENT_TIMESTAMP() FROM TB_PRODUTO

I don’t know if this information helps but my server is Hostinger.

  • 3

    have to check this with Hostinger, look more about CRON

  • Oh thank you, that’s right. I’m just wondering, I don’t know if all the servers are like this but Hostinger creates a wp-cron.php file, in this file I run my php query normally right?

  • any file . php runs on the php server has to attach on the linux system service ... !

1 answer

1


You can access your Mysql phpmyadmin, access the database and go on events (Event Scheduler), is next to routine. There you define the periodicity of the execution of this query, will be the fastest solution at this time.

Another option would be to have access to crontab, in this case it is possible to execute any command you use in SSH, I recommend studying this second, because it is very useful.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.