Forum Moderators: coopster
Team WINS LOSSES TIES Points
Team A 7 2 1 15
Team B 5 3 3 13
Team C 3 5 4 10
I want I want the db to automatically update the points and order them accordingly. Probably easy but my brain is fried from the rest of the website.
TeamA beats TeamC
update tablename set wins=8, points=16 where team='Team A';
update tablename set losses=6 where team='Team C'
the logic around how php would construct those queries is longer but fairly straight forward.
1. get present rows for the 2 teams
2. get result of game
3. calculate new points based on result
4. update both rows