Forum Moderators: coopster
Not sure if this is possible or not due to being fairly new to the php world of poety.
I want to have a table showing Football (Soccer) league from the premiership league.
e.g.
Position--Team--Pld--Won--Drawn--Lost--For--Against--Points
1 --Chel-- 9 -- 7 -- 1 -- 1 --21 -- 5 -- 22
And so on.
The way i want to update this is through a custom CMS.
However, i don't just want to make changes to the league, i want to fill out the result of the game
e.g. chelsea 2 - 1 sunderland
and that will then automatically correct the league, e.g. give chelsea 3 pts for winning, adding a win, adding 2 goals to the 'For' section and 1 for the 'Against' section. Then is the position of the team changes, alter this.
Can someone point me in the right direction to get started.
1) Is this even possible?
2) How many db Tables will i need?
- i imagine it would be 2 tables, one for the results and one for the league table.
3) How would i automatically run the update once the results have been filled out?
Any help would be much appreicated.
If you need more info, then please let me know.
Please note that i have not made a start at any coding yet as not sure where to start.
Thanks in advanced.
Dwighty
anything is possible. Some things shouldn't be done because they are foolish but this isn't one of those things.
2) How many db Tables will i need?
- i imagine it would be 2 tables, one for the results and one for the league table.
possibly. This is just wild guess designing so take it with a grain of salt.
given the structure of the table you laid out that would work. A second table that has all of the games and scores might work. On thing I would add to the first table is team_id
the second table could then look something like
home_team_id
away_team_id
home_score
away_score
maybe a match_id in that table too though I am not sure whether that is needed or not. That's pretty rough too. You may want to add other fields to your team table too depending on what will be done with them.
3) How would i automatically run the update once the results have been filled out?
have a small form
select home team and away team from a drop down which will show the team name but pass the team_id to be sued in your matches table.
enter the scores beside the two teams
on submit you can
insert new row into matches table
select from teams where team_id == home_team_id or == away_team_id
add the new values to the old
update the two team rows
that's a pretty basic description but it should get you rolling.
[edited by: jatar_k at 3:28 am (utc) on Oct. 8, 2005]
[edit reason] swapped url [/edit]