Jump to content


Photo

calculation help


  • Please log in to reply
1 reply to this topic

#1 esiason14

esiason14
  • Members
  • PipPipPip
  • Advanced Member
  • 58 posts

Posted 22 March 2006 - 04:24 PM

I'm trying to do some calculations, but I'm having a little trouble...actually a lot. This is what I would like to do:

(fantasy football points based on NFL team defenses, by week)

If a defense allows 0-6 points, make it worth 10 pts
If a defense allows 7-13 points, make it worth 7
If a defense allows 14-20 points, make it worth 4pts
If a defense allows 21-27 points, make it worth 1 pts
If a defense allows 28-34 points, make it worth 0 pts
If a defense allows >34 points, calculate using -1 pts

I have the query down, but just need some help doing the calculations of the output. Can someone help me out

#2 lead2gold

lead2gold
  • Members
  • PipPipPip
  • Advanced Member
  • 164 posts
  • LocationOttawa, On

Posted 22 March 2006 - 04:38 PM

[!--quoteo(post=357332:date=Mar 22 2006, 11:24 AM:name=esiason14)--][div class=\'quotetop\']QUOTE(esiason14 @ Mar 22 2006, 11:24 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I'm trying to do some calculations, but I'm having a little trouble...actually a lot. This is what I would like to do:

(fantasy football points based on NFL team defenses, by week)

If a defense allows 0-6 points, make it worth 10 pts
If a defense allows 7-13 points, make it worth 7
If a defense allows 14-20 points, make it worth 4pts
If a defense allows 21-27 points, make it worth 1 pts
If a defense allows 28-34 points, make it worth 0 pts
If a defense allows >34 points, calculate using -1 pts

I have the query down, but just need some help doing the calculations of the output. Can someone help me out
[/quote]
$d_val = 0
if($defense > 34)      $d_val = -1;
else if($defense > 28)$d_val = 0;
else if($defense > 21)$d_val = 1;
else if($defense > 14)$d_val = 4;
else if($defense > 7)  $d_val = 7;
else $d_val = 10;  // $d_val is less then 7

assume that $defense is the points the defense aquired. $d_val is the decided final defense points to award.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users