|
Posted by Geoff Muldoon on 10/21/18 11:25
phpfrizzle@gmail.com says...
> Hi there,
>
> I have this soccer site, and in 1 part one
> can manage the played matches:
> Score, location, players who scored etc.
>
> Now the last part is what i have a question about.
> The players are in a MYSQL db. Each has it's own
> unique ID.
> Fields:
> - id
> - firstname
> - lastname
> - position
>
> Matches are also stored in the DB.
> Fields:
> - id
> - opponent
> - location
> - date
> - homepoints
> - visitorspoints
>
> If i have a new match, and the score is 5-3 how should
> i add 5 player's ID of players who scored (in a yet to
> create DB-field), in that way that i can get the person
> that scored the most ... (topscorer)
> And 2nd, and 3rd etc.
Suggestions if you really want to allow for increased data flexibility in
the future:
A player's position could change for match to match, so maybe it shouldn't
be a fixed attribute for the player, or maybe should be "usual_position".
I'd use a third "player_match" table,
Fields:
- match_id
- player_id
- played_position
- goals_scored
- .... other stuff you might want to record, field time (replacements
etc), cardings, a comments field ....
I'd probably look at recording all players not just goal scorers in this
table, more input time but more data to play with.
Assuming you are only going to record the details for you own club, not
the whole league, then alter your "matches" table and just have a column
for "opponent_goals", then (presuming they refer to league table points)
homepoints and visitorspoints are just derived values.
Geoff M
Navigation:
[Reply to this message]
|