esiason14 Posted March 22, 2006 Share Posted March 22, 2006 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 ptsIf a defense allows 7-13 points, make it worth 7If 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 ptsI 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 More sharing options...
lead2gold Posted March 22, 2006 Share Posted March 22, 2006 [!--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 ptsIf a defense allows 7-13 points, make it worth 7If 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 ptsI have the query down, but just need some help doing the calculations of the output. Can someone help me out[/quote][code]$d_val = 0if($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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.