Jump to content

Help with sum


shedcade

Recommended Posts

Hi all,

 

I've run into a bit of a problem, I'm producing some stats based on a football/soccer league table.

 

I'm determining an individuals last ten results to output a form guide Won, Lost, Drawn, etc.

 

However i would like to take this form and add up the equivalent points total for the last ten games.

 

I am determining how to show my WLD record using the following part, which works great and i've now added in a points equivalent for each result.

 

if ($scores_list['user_id_1_score'] > $scores_list['user_id_2_score'] && $scores_list['user_id_1'] == $imageleader['LINK']) {
$win = 'W';
$pts = '3';  } 
elseif ($scores_list['user_id_1_score'] > $scores_list['user_id_2_score'] && ($scores_list['user_id_2'] == $imageleader['LINK'])) {
$win = 'L';
$pts = '0';}
elseif ($scores_list['user_id_1_score'] == $scores_list['user_id_2_score'] && ($scores_list['user_id_1'] == $imageleader['LINK'])) {
$win = 'D';
$pts = '1';}
elseif ($scores_list['user_id_1_score'] == $scores_list['user_id_2_score'] && ($scores_list['user_id_2'] == $imageleader['LINK'])) {
$win = 'D';
$pts = '1';}
elseif ($scores_list['user_id_1_score'] < $scores_list['user_id_2_score'] && ($scores_list['user_id_2'] == $imageleader['LINK'])) {
$win = 'W';
$pts = '3';}
elseif ($scores_list['user_id_1_score'] < $scores_list['user_id_2_score'] && ($scores_list['user_id_1'] == $imageleader['LINK'])) {
$win = 'L';
$pts = '0'; }

 

If i output the $pts i see the last ten games points equivalent, e.g. 3310013300

 

What i need to be able to do is get the total of these figures? Can it be done?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/265824-help-with-sum/
Share on other sites

Hi shedcade

Purely out of curiosity, what is '== $imageleader['LINK']' referencing? The only reason I ask is I created a Current Form table (http://www.margate-fc.com/content/1st_team/cform.php?season_id=105), as well as standard, home and away tables and a stack of other football stats,  for a site a couple of years back and am just about to start a rewrite of the entire code, so wondered if it is anything that I can use to improve my functionality.

 

If there is anything else football stat related that you are looking to do, I might, be able to help. I am no php genius but as a lot of what I have done has come from advice on here, it can't be too bad!!!

 

Thanks

Steve

 

Link to comment
https://forums.phpfreaks.com/topic/265824-help-with-sum/#findComment-1363134
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.