max_w1 Posted January 20, 2008 Share Posted January 20, 2008 hi! i am designing a website in php & mysql which is like a game. every thing was going file till now but now i am stuck and confused.. in this website members can capture around 100 fighters and teach them over 50 different attacks. i know the php part but don't know how the sql structure should be for this. any kind of idea or help will be appreciated EDIT: Changed subject to conform to forum rules. Quote Link to comment https://forums.phpfreaks.com/topic/86899-table-structure-question/ Share on other sites More sharing options...
GingerRobot Posted January 20, 2008 Share Posted January 20, 2008 I would suggest four tables, in addition to your users table, for this: captured_fighters id - primary key, auto increment userid - links to users.id fighterid links to fighters.id fighters id - primary key, auto increment fightername any attributes of the fighter - speed, strength etc attacks_taught id - primary key, auto increment attackid - links to attacks.id capturedfighterid - links to captured_fighters.id attacks id - primary key, auto increment attackname attributes of the attack - damage, type etc Without knowing the details of the game, i've had to be a bit vague. But i would imagine it would be similar to the above. Quote Link to comment https://forums.phpfreaks.com/topic/86899-table-structure-question/#findComment-444468 Share on other sites More sharing options...
max_w1 Posted January 21, 2008 Author Share Posted January 21, 2008 thankyou GingerRobot, hope that will solve my problem. but what if i include all colums in a single table "users"? like: users username = the username of mr.xyz password = the passowrd of mr.xyz details = details of mr.xyz fighter1 = the first fighter mr.xyx has captured fighter2 = the secont one fighter3 = third "... fighter100 = till the last one attack1 = first attack attack2 = second "... attack50 = last one F1a1= Fighter Attack(the attack which has been thought to fighter) f1a2 = the second till f100a50 = last attack of the last fighter. will this be possible.?? or creating this many colums will slow down my website? because there would be more than 500 colums in a single table. Quote Link to comment https://forums.phpfreaks.com/topic/86899-table-structure-question/#findComment-444922 Share on other sites More sharing options...
GingerRobot Posted January 21, 2008 Share Posted January 21, 2008 Bad idea. If you were considering doing something like that, i suggest that you read up on database normalization. You could see this thread for starters: http://www.phpfreaks.com/forums/index.php/topic,126097.0.html And there would actually be over 5000 columns in your table. Quote Link to comment https://forums.phpfreaks.com/topic/86899-table-structure-question/#findComment-445095 Share on other sites More sharing options...
max_w1 Posted January 21, 2008 Author Share Posted January 21, 2008 Thankyou GingerRobot! that was very helpful, i solved my problem, and my website will be ready to launch after three days. thankyou once again... keepup the good work! Quote Link to comment https://forums.phpfreaks.com/topic/86899-table-structure-question/#findComment-445318 Share on other sites More sharing options...
max_w1 Posted January 25, 2008 Author Share Posted January 25, 2008 Thankyou GingerRobot! that was very helpful, i solved my problem, and my website will be ready to launch after three days. thankyou once again... keepup the good work! Sorry for that! but it didnt work!! can someone tell me what is users.id and fighters.id and how to create links Quote Link to comment https://forums.phpfreaks.com/topic/86899-table-structure-question/#findComment-448809 Share on other sites More sharing options...
GingerRobot Posted January 25, 2008 Share Posted January 25, 2008 users.id refers to the id field in the users table. I suggest you read up on database normalization and joins - selecting data from multiple tables. Quote Link to comment https://forums.phpfreaks.com/topic/86899-table-structure-question/#findComment-448917 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.