tags:

views:

36

answers:

4

Let's say a player's energy is recorded in a table as "20". As he engages in mission, his energy decreases and reaches 0. However, it would be replenish back to "20" the following day. How do the database detect that a new day has arrive and then automatically assign some value in a certain table?

+1  A: 

Store in database the time (date and hour) when energy should be restored. Then each time player logs in check if this time passed yet or not. If it has, restore the energy.

Mchl
A: 

Not at all. Call a stored procedure / execute SQL regularly from OUTSIDE the database.

TomTom
+1  A: 

Upgrade to MySQL 5.1 and use events. http://dev.mysql.com/tech-resources/articles/mysql-events.html

Timothy
A: 

Use a Trigger that'll run when your condition is verified

iChaib