Jump to content

Table structure question


max_w1

Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/86899-table-structure-question/
Share on other sites

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.

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.

 

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.

 

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 :(

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.