Hello rifts, I too am in the process of making a game (Text based MMORPG to be precise) and fell short at the exact same problem.
I did however come up with a solution, which I will soon implement myself but read on.
Firstly, you should create a table called item_database or whatever you want.
This will hold the items within your game and store such details as:
item_id - The ID number of the item (unique)
item_name - The name of the item (varchar)
item_description - A brief description of the item ect (longtext)
item_type - The type of item this is, head, torso, legs, shield, weapon, aug, necklace, gloves, boots, potion, collectable card ot whatever.
item_attack, item_defence, item_hp - These will be the attributes of the item (int)
Any other details you require
Secondly, you create a table called player_items or whatever you want.
This database will be used to link to player profiles aswell as the item database.
Such fields would include:
id - A unique identifier (unique)
main_item_id - The Item ID number from the item_database that this represents (int)
player_id - The ID number of the player that owns the item (int)
Other details could be whether the item is upgraded, or how rare it is ect.
Finally, and the users database add some fields such as:
head_slot - The id number of the item in the player_items database that is in this players head slot (int)
Then the databases would work something like the following:
// Lets fetch the head_slot ID Number here
$myQuery1 = mysql_fecth_assoc(mysql_query("SELECT head_slot FROM user_database WHERE user_id='$user_id' LIMIT 1"));
// Use the head_slot ID number to select the item from the player_items database
$myQuery2 = mysql_fetch_assoc(mysql_query("SELECT main_item_id FROM player_items WHERE id='$myQuery1[head_slot]' LIMIT 1"));
// Use the item_id number from the previous query
// Now we select the item that matchs the item_id from the main item_database
$myQuery3 = mysql_fetch_assoc(mysql_query("SELECT item_id FROM item_database WHERE item_id='$myQuery2[item_id]' LIMIT 1"));
Hopefully this will make some sense to you and can use this to help with you situation.
(I just hope I havent written all this for nothing )
Thanks, Paul.