How To Sum goals

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

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 

hi have this code 

<?php
$totalGoalf = 0;
$matches = mysql_select('matches');

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


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

but how can i limit result where to "team_a is XX and season is XX"

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/