
May 5th, 2003, 12:14 AM
|
|
Registered User
|
|
Join Date: Apr 2007
Posts: 22,309
Time spent in forums: < 1 sec
Reputation Power: 24
|
|
|
creating tables
Hi Guys,
I'm creating a football statistics site, for my local team.
I know how to create a table, however I think for what I want to do, I might need to create 2 tables.
1 table for plays, 1 table for teams.
What I am doing is recording things like goals scored, tries scored etc, by each player against each team.
It can be done on 1 table, however it means I would have to create a lot of different fields, such as, goals_team1, goals_team2, tries_team1, tries_team2, and so on. There is over 15 teams and about 7 different stats that would be recored, so 15 x 7 would be a lot of fields, and that would mean having to create each team .php page seperately, as the output would be coming from a field with a different name.
So what I would to do is have it so the fields are the same, just the rows are different. example.
goals tries tackles
team 1
team 2
team 3
team 4
however where would I put the players name? I heard something about putting the players on a different table and linking the player to the team using an ID.
I have no idea about this and am hoping someone could assist me.
Also, is it possible to add (+) data from 2 different tables? example - player 1 gets 2 goals against team 1 and 3 goals against team 2. On the .php page, can you run a query to add those 2 fields and make it out put the total goals? Would it be a simple query or a long one?
Thanks
|