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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.