How to implement automated tasks with php on the server side?

In a simple example.
A regular clicker on the website with usloviyami.
A person buys an improvement and after, every minute in the database should be added to the old value, the new (Once used for the top, that is, the addition of these data only if the login user is not accepted).
There must be a condition in this task.
Question. How to implement such functionality with minimal loads.
As if crowns will enter data every minute and if a lot of players, then the base will just fall. Perhaps there is some sort of alternative on the php side or in the most building tasks...
How is it implemented on the site?
Can't find the network. All written cron and all.
April 3rd 20 at 18:36
2 answers
April 3rd 20 at 18:38
Solution
>every minute in the database should be added to its old value
save in database the last access time and before the readout, plus the right amount.
Yeah thought so too, by date. But I have a separate field under the total number of accumulated numbers. That is, it will work only when user is logged in. For example, for a top who have more, there will be updated data. - Yolanda.Cronin commented on April 3rd 20 at 18:41
@Yolanda.Cronincame in, calculate and save.
handled page - calculate and save. and so on.
for the top too, no one bothers to calculate and save) or may not even save if the calculations in php are cheaper than the entry in database - Kianna.OHa commented on April 3rd 20 at 18:44
@Kianna.OHa, That is another better option, no? Just opened - calculate - retained... etc etc And to top it's hard to bust if a lot of people, whenever you log in to the top will search all the users and processed all the data about their savings ... - Yolanda.Cronin commented on April 3rd 20 at 18:47
accumulated, brought - on to refresh the page - pokrocily JS'om - Kianna.OHa commented on April 3rd 20 at 18:50
Accumulating points clear like. At the expense of the top, if you do a query like this: calculate how many points the user from the starting date to the date now with the condition of the improvements, it will not be too loaded? - Yolanda.Cronin commented on April 3rd 20 at 18:53
April 3rd 20 at 18:40
I have a great plan. Below is padding not ate resources I suggest not to.
Instead, record the date purchase, improvement, and when the as wants vzhlyanut on my figure just to calculate the current value according to the formula by the formula.
Type
betweennasa + (presetsheaven * znachennya)
Yeah thought so too, by date. But I have a separate field under the total number of accumulated numbers. That is, it will work only when user is logged in. For example, for a top who have more, there will be updated data. - Yolanda.Cronin commented on April 3rd 20 at 18:43
@Yolanda.Cronin, Then make in addition to every 10 minutes to run the script that all users will take the points. - Mitchel_Powlowski30 commented on April 3rd 20 at 18:46

Find more questions by tags PHPMySQLThe task schedulers