Hello, HashCode.
I have a table in which there is a number 0 (for example), and I need it to automatically increase every 14 hours by 1 and so on all records. How to do it or in what direction to dig?
Hello, HashCode.
I have a table in which there is a number 0 (for example), and I need it to automatically increase every 14 hours by 1 and so on all records. How to do it or in what direction to dig?
Create a JOB in which you write the usual update with the changes you need, and in the JOB settings, specify the call frequency and that's it.
Every 14 hours, using cron for example, make a query to the database
UPDATE `table_name` SET `counter_name` = `counter_name`+1
Php script can still be called with cron
. He will automatically call every 14 hours. And the php
script will then update
"th increase by one value.
It is not clear what tools you use. Maybe you are doing a desktop application (in C #, for example), maybe a Web application. I will focus on the latter, since it seems to me that this is what you need.
You can easily make such a thing: for this you need to leave a timestamp somewhere (in a text file) every 14 hours, where the last increment was made. Then each time you enter the site, the script (rather, PHP) will have to look at that very label and subtract it from the current one. Then you will only have to convert the difference in time stamps into hours and check whether it is equal or not more than 14, if so, then update the label in the same file and increment a specific value in the database.
Source: https://ru.stackoverflow.com/questions/134746/
All Articles