apw Posted January 27, 2009 Share Posted January 27, 2009 My question is regarding info that should either be in a single table database or multiple tables. The data that will be in this or these tables is data that my web-game uses to handle player information. For example one table called pfile handles the basic login info and a few starting stats. As the player plays he will gain new technologies, new buildings, units, etc. My question is with so much info that will be processed and needed is it smart and wise to push this into one table or expand and have multiple tables for each technology, unit, resource, etc. And how would i link this info together so nothing goes wrong? Quote Link to comment https://forums.phpfreaks.com/topic/142640-multiple-or-single-table/ Share on other sites More sharing options...
MadTechie Posted January 27, 2009 Share Posted January 27, 2009 On the new table have a field Called UserID (this will have the same value as the Prime field in the usres table) and IMO i would probably keep a table for logins and another for game status info EDIT: oh and link them via a JOIN but if you have the UserID stored in session during login you can just pass that to the other table directly to get Game Info) but if you want to get the Users name etc your need to either use a JOIN or do 2 queries Quote Link to comment https://forums.phpfreaks.com/topic/142640-multiple-or-single-table/#findComment-747628 Share on other sites More sharing options...
apw Posted January 27, 2009 Author Share Posted January 27, 2009 The userid field will carryover the players id# across every table i create without having to carryover the players login name? Quote Link to comment https://forums.phpfreaks.com/topic/142640-multiple-or-single-table/#findComment-747637 Share on other sites More sharing options...
haku Posted January 27, 2009 Share Posted January 27, 2009 That's what you use 'joins' for. They are a type of query that allow you to join two tables together, based on a common value (the user ID in this case). Quote Link to comment https://forums.phpfreaks.com/topic/142640-multiple-or-single-table/#findComment-747640 Share on other sites More sharing options...
apw Posted January 27, 2009 Author Share Posted January 27, 2009 Thank-you for the help i will read more into how to joim my tables together Quote Link to comment https://forums.phpfreaks.com/topic/142640-multiple-or-single-table/#findComment-747664 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.