Hi,
I have a game (or at least it is well under construction) which is written in php.
In a database, I have a table called users where it stores details such as usernames, passwords, email addresses, number of each unit type, number of each resource, number of each building type etc etc. Another table called units stores all the information about each unit such as daily costs and the main cost for each resource when you train your villagers into them. It also stores information about their income and which resource they bring in. There is also a table called "things" - simply cos I could not think of a better name. It stores the number of different units and number of different buildings available so that I can use those figures on the buildings page and units page (for purchasing). There is another table called resources which stores all the information about resources - at the moment it is just the resource names. There is one, last table called buildings which stores all the information about buildings - basically the same as units but for buildings.
There are various costs for each unit in various resources - ie one unit may cost x gold and y food, another may cost a stone and b food etc etc. I would like it to, on the train villagers page, go through each resource by going through resources->resource (the resource column in the resources table) and check that there is enough of each resource to buy the specified number of units. It will only purchase the units IF there is enough of ALL the resources - if one fails then it will not purchase them. I can not figure this bit out.
Over time, I am hoping to make it so that I can add a unit, resource or building whilst I am logged in and it will do all the hardwork for me (adding columns in relevant tables etc.).
I will reveal the site address when I have updated the registration page so that it works properly.
PLEASE HELP ME!
RC