How To Sum goals

4 posts by 2 authors in: Forums > CMS Builder
Last Post: October 24, 2013   (RSS)

By mbareara - October 24, 2013

I hope to find a answer :-)

I have a football site and i would punt in it some stats

I have a table called Matches (num, team_a, team_b, goal_home, goal_away, season)

How can i sum total of goal home where "team_a is XX and season is XX"?

Thank you in advance for your help

Orazio 

By mbareara - October 24, 2013

Ok solved :D

<?php 
$totalGoalf = 0; 
$matches = mysql_select('matches', "team_a = '1' AND season = " . intval($seasonRecord['num']));

foreach ($matches as $matches) { 
$totalGoalf += floatval($matches['goal_home']); 
}


?><?php echo number_format($totalGoalf) ?>

By Damon - October 24, 2013

Glad to see you solved it and thanks for shared the solution!  :)

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/