a method of processing something after a specific time

Asked 1 years ago, Updated 1 years ago, 59 views

Thank you for your help.

I'm sorry that I haven't spent much time since the last question.

When creating simulation games with PHP+Mysql (same as last time),
This time, it's like when you attack the other country from your own country.

On my browser's side, I select the other country and go to the front, and the arrival (the result) is
Let's say 30 minutes later, but before that, you and the other side close the browser and
No manual data updates at all, but after 30 minutes, a third party

When you are in a state where you can see what happened to the country of the person who was attacked,
I think I have to update it in 30 minutes, but this kind of thing is
Is it possible for the server to do this in seconds?

In addition to issuing SQL, you can also obtain data about yourself and the other country, and how aggressive you are.
After calculating durability, I want the results to be reflected in the database.

Will this be a PHP problem instead of mysql?

Thank you for your cooperation.

php mysql sql

2022-09-30 20:52

2 Answers

In general, I think the result of winning or losing is stored in the database when you press the advance.
At that time, I will register the available time (30 minutes later), and if the user logs in and exceeds the available time, the result will be displayed, and if not, the user will be displayed as "on the battlefield."


2022-09-30 20:52

Write an example of how the event works exactly on time.

When an event occurs, leave the MySQL table with the event type, the time to process the event, and the processed flag as zero.

Then, look at the table when someone accesses it, process the current time > processing time, and process the processed flag in chronological order, and set the processed flag.

Now I think I can handle the events in order.

You can delete the finished record itself without using the processed flag.


2022-09-30 20:52

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.