Jump to content

Archived

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

esiason14

calculation help

Recommended Posts

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

Share this post


Link to post
Share on other sites
[!--quoteo(post=357332:date=Mar 22 2006, 11:24 AM:name=esiason14)--][div class=\'quotetop\']QUOTE(esiason14 @ Mar 22 2006, 11:24 AM) [snapback]357332[/snapback][/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]
[code]
$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[/code]

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

Share this post


Link to post
Share on other sites

×

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.