Zhyrios Posted March 20, 2012 Share Posted March 20, 2012 i'm just having a little bit of a play around making a browser-based text RPG with PHP and mySQL. But when it comes to creating a system where a player can view their inventory, and for that matter -have- items. i just don't know where to begin. Would i make a seperate database for inventories and have each column in the database be a different inventory slot and then have the value in that field be in reference to an item? like 1 = potion, 2= ether, etc? with a large amount of items and inventory space for each player i don't want to get started down a long road on the wrong path. To reiterate, I'm not asking for the code specifically i'm just asking what way I would go about it. What would be the simplest, least headachey method of such a system? Quote Link to comment https://forums.phpfreaks.com/topic/259321-inventory-scriptdatabase/ Share on other sites More sharing options...
gizmola Posted March 20, 2012 Share Posted March 20, 2012 It's a non-trivial schema, but in general terms, I'd recommend a standard normalized relational database design. -items table (one row for each possible item) -worldItem (a row for an item that actually exists in the world) -player (row per player) -playerWorldItem (relates a worldItem to a player/slot) Quote Link to comment https://forums.phpfreaks.com/topic/259321-inventory-scriptdatabase/#findComment-1329330 Share on other sites More sharing options...
Zhyrios Posted March 21, 2012 Author Share Posted March 21, 2012 Thanks Gizmola Quote Link to comment https://forums.phpfreaks.com/topic/259321-inventory-scriptdatabase/#findComment-1329744 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.