Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/5509-calculation-help/
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.

Link to comment
https://forums.phpfreaks.com/topic/5509-calculation-help/#findComment-19692
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.