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
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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.