View Single Post
  #7  
Old 01-21-2014, 03:29 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Here's how I would do it:

Characters

ID - Account

1 - Toran
2 - Toran2

Index on Account

Items

ID - Itemname

1 - Apple
2 - Orange
3 - Banana
4 - Grape

Index on Itemname

CharacterItems

ID - CharacterID - ItemID - Quantity

1 - 1 - 1 - 2
2 - 1 - 2 - 1
3 - 2 - 3 - 4
4 - 2 - 4 - 3

Index on CharacterID
Index on ItemID

Note: ID columns are auto-increment columns. So they just go 1, 2, 3, 4, etc. as you add rows to the table.

On login/character load, you would do a query to load all their item information with at least query and store it in a clientr flag for quick-reference.

When you're making changes (i.e. adding items), you would make them to the database first then reflect that in their clientr flags.
__________________
Quote:
Reply With Quote