MySQL Table Question > Array?

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default MySQL Table Question > Array?

    I'm programming a Gaming Ladder/Tournament system.
    Let's say I have the following tables:

    PLAYERS
    -------
    * Player_ID
    * Player_name
    ....
    * Team_ID

    TEAMS
    -----
    * Team_ID
    * Team_Name
    ....
    * Ladder_ID <--- Notice this one!

    LADDERS
    -------
    * Ladder_ID
    * Ladder_Name
    * Ladder_Description
    ....

    The question is about the 'Ladder_ID' field in the TEAMS table.

    For instance, when a team joins 2 ladders/competitions, how do I store this?

    Do I fill the LADDER_ID field in the TEAMS table with an ARRAY of values
    (e.g. Ladder ID's 1, 3 & 4) ? Is there a better way to associate teams with
    multiple Ladders?

    Tia.



    Sixii Guest

  2. Similar Questions and Discussions

    1. newbie question. how to assign an array to a hash table?
      Hi, I have something like: $value = 'A' 'C' 'G'; and I would like store this value on a hash table. my @value = split(' ',$value); print...
    2. array question (grep -v on array)
      Hi, I have an output of errors fed into an array, after which I only look at things I care about and put them in a different array: ...
    3. newbie php MySQL table question
      Thanks to you both guys. As for reading the manual - I have 4 in front of me and couldn't find the answer to my problem. Some things you do find,...
    4. php mysql array question
      I use the PEAR db http://pear.php.net/manual/en/package.database.php This returns arrays - examples here...
    5. [PHP] php mysql array question
      > Is there any php function to pull a query into an array? I know there is a loop looking used There's no PHP function to do so. Some...
  3. #2

    Default Re: MySQL Table Question > Array?


    "Sixii" <sixii@yahoo.com> wrote in message
    news:yWVfb.84383$lh.17543286@amsnews02.chello.com. ..
    > I'm programming a Gaming Ladder/Tournament system.
    > Let's say I have the following tables:
    >
    <CUT>
    > The question is about the 'Ladder_ID' field in the TEAMS table.
    >
    > For instance, when a team joins 2 ladders/competitions, how do I store
    this?
    >
    > Do I fill the LADDER_ID field in the TEAMS table with an ARRAY of values
    > (e.g. Ladder ID's 1, 3 & 4) ? Is there a better way to associate teams
    with
    > multiple Ladders?
    I suggest you create an extra table linking teams on ladders, instead of
    using a ladder field on the team table.
    It can be a simple table with only 2 key fields (ladder and team) or can
    even hold more information for that team in that particular ladder.

    Cheers,
    Peter


    Peter Vernout Guest

  4. #3

    Default Re: MySQL Table Question > Array?

    "Sixii" <sixii@yahoo.com> wrote in
    news:yWVfb.84383$lh.17543286@amsnews02.chello.com:
    > I'm programming a Gaming Ladder/Tournament system.
    > Let's say I have the following tables:
    >
    > PLAYERS
    > -------
    > * Player_ID
    > * Player_name
    > ...
    > * Team_ID
    >
    > TEAMS
    > -----
    > * Team_ID
    > * Team_Name
    > ...
    > * Ladder_ID <--- Notice this one!
    >
    > LADDERS
    > -------
    > * Ladder_ID
    > * Ladder_Name
    > * Ladder_Description
    > ...
    >
    > The question is about the 'Ladder_ID' field in the TEAMS table.
    >
    > For instance, when a team joins 2 ladders/competitions, how do I store
    > this?
    A table with two fields. I've shown a row_id but you don't really need it
    (but good to have), unless you wanted to maybe add an extra field to
    track scores or make comments for a particular team in a particular
    ladder. I've also made it so that teams are constructed the same way -
    ie. in case you ever need to have one player in more than one team.
    >
    > Do I fill the LADDER_ID field in the TEAMS table with an ARRAY of
    > values (e.g. Ladder ID's 1, 3 & 4) ? Is there a better way to
    > associate teams with multiple Ladders?
    I think this is a bad idea. With the competition table below you can
    select the Ladder_ID you want and return all the Team_ID's in that
    competition. the TEAM_MEMBERS and LADDER_MEMBERS table are essentially
    composed of foreign keys with multiple team_id and ladder_id entries for
    each team or ladder

    I'd have:

    PLAYERS
    -------
    * Player_ID <- Primary Key
    * Player_name

    TEAMS
    -----
    * Team_ID <- Primary Key
    * Team_Name

    LADDERS
    -------
    * Ladder_ID <- Primary Key
    * Ladder_Name
    * Ladder_Description

    TEAM_MEMBERS
    -------
    *Row_ID <- Primary Key
    *Team_ID
    *Player_ID

    LADDER_MEMBERS
    -------
    *Row_ID <- Primary Key
    *Ladder_ID
    *Team_ID
    *Comment (optional)

    - e.g.

    LADDER_MEMBERS
    -------
    0 1 1
    1 1 2
    2 1 3 'They did ok this comp, might do better next time'
    3 2 3 'This team really did well this time around'
    4 2 4
    5 3 1
    6 3 5
    7 3 10
    8 3 2 'This team really sucked at this comp.'
    renster Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139