A small MYSQL storing/retrieving data based command. How?
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
This is of how I thought of this:

- Main table factions with 2 columns: factionid (PRIMARY KEY and auto increment) and leader (default value 0).
- Child table factions_members with 2 columns: factionid (references to factions.factionid so if a faction is deleted from main table, all its members will be removed from this table as well) and userid (upon registering a unique ID for each player - references to players.userid).

For the query in /factions, you can use JOIN to get the player's name of the leader and COUNT for the total (rows) members of each faction.
Needs one more column to store rank. The player with the highest rank is then automatically the leader, so a faction can't be leaderless.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)