SQL update problem
-
Hey, We are making a game like travian (www.travian.com) in php and SQL. Now we are facing a serious problem. We have the following example: Player A attacks player B, and this attack takes 1 hour. In the meantime player A and B are logged out. But the attack must be performed, since their teammates would like to know the status of the attack too. Now how can we execute a certain code at a specific time, NOT using players, so on the server? We're using a SQL database, and the coding is done in Php. I heard something about Stored Procedures...? Thanks in advance, Zaegra
Motivation is the key to software development.
-
Hey, We are making a game like travian (www.travian.com) in php and SQL. Now we are facing a serious problem. We have the following example: Player A attacks player B, and this attack takes 1 hour. In the meantime player A and B are logged out. But the attack must be performed, since their teammates would like to know the status of the attack too. Now how can we execute a certain code at a specific time, NOT using players, so on the server? We're using a SQL database, and the coding is done in Php. I heard something about Stored Procedures...? Thanks in advance, Zaegra
Motivation is the key to software development.
I have one Idea 1. When ever a player attacks, insert the value in the database with the Execution timestamp. 2. Create a procedure to perform the tasks by fetching the rows from attack table(Which are pending, can be marked with status field) 3. Schedule the procedure to run after a particular interval of time. I think it will solve your problem
Regards Aman Bhullar www.arlivesupport.com[^]