Good Morning,

I am writing code for a Hockey Pool site and I am working on the Standings page...typical divisional standings page.

My code runs through a loop for the four teams in each division and yields results for each team and outputs fine. Here is my problem...I want to sum the sums of the four teams.

For example, with Games Played it calculates the total GP for each team with the following chunk of code.

// GP
echo "</td><td width='40'align='center' bgcolor='FFFFFF'><font face='arial' size='2' color='000000'>";
echo $ttl_GP;

This outputs a result of Team 1 - 57, Team 2 - 57, Team 3 - 58, Team 4 - 60.

I would now like to be able to sum these in final row to yield a result of 232.

Here is what I have tried but it echos "0". I think my syntax may be off.


Any help would be appreciated.

Edited by ceeandcee: n/a

6 Years
Discussion Span
Last Post by ceeandcee

You're adding the same value over and over again $row['Team'] Assuming each team has their own names (Team1, Team2, Team3 etc) then you could try this:


All I've done is add numbers to each.


Thanks...I think we are close...but it is not finding a value for each team and thus adding 0+0+0+0 to give 0. I will keep playing around.


I think I will update the database with the summed total and then echo the sum of that column and that will make it work. Thanks for your help.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.