auto update
*WHAT I HAVE*
CREATE TABLE Players
(
Person varchar(12)
Policy char(12)
Tax int(2)
)
INSERT INTO Players (Person,Policy,Tax)
VALUES (Adam,domestic,9)
VALUES (Burt,military,8)
VALUES (Carol,agricultural,7)
CREATE TABLE Towns
(
Owner
Place
Population
Building
)
INSERT INTO Towns (Owner,Place,Population,Building)
VALUES (Adam,London,15000,Cathedral)
VALUES (Burt,York,5000,Chapel)
VALUES (Carol,Norwich,6000,Church)
*WHAT I WANT TO DO*
I want to automatically update this each day, where one day is equal
to one year.
If the policy is domestic, growth is 3%
If the policy is agricultural, growth is 2%
If the policy is military, growth is 1%
plus
If a cathedral is present, growth is an additional 10%
If a cathedral is present, growth is an additional 5%
If a cathedral is present, growth is an additional 2%
minus
If the tax is 1, then growth is decreased by 1%
(the maximum tax is 20)
Now for example in year 1, I have a population of 15000 in London.
In year 2 this ought to be a population of 15600.
*THE PROBLEM*
I know how to do the population growth calculation with PHP, that's the easy part. Unfortunately since I'm quite new at this, I have no clue, on how to make the tables automatically update the population figure daily. This has to happen each day, wether the user logs in or not. As the reader understands by now, I want to use this in a small multiplayer game I'm trying to create.
So how do I do this? Any help will be greatly appreciated. Thanks in advance.
|