I run a fantasy sports league where users pick a team of players whose points update based on performance. I have two tables - one called "players" for players and their points, and one table called "teams" where the users player selections are stored. I generated the code for updating the player points, now I need help creating the code to sum the total player points for each user team. Basically I'm a newbie who tries to learn from existing code but I don't have anything to go by on this one...
The general idea of what I want to do is as below.
for each row "i" in table "teams"
$total = 0;
for column "j" where "j" = "1,2,3, ... 12" in row "i" of table "teams"
retrieve "choice" from "teams" contained in (row, column)
retrieve "points" from "players" where players.name = teams.choice
$total = $total + player.points
next column
update column "total" in row "i" with value $total
next row
Thanks in advance for the help on coding this.