Checking Points…

'$min_date'"; $results = mysql_query($sql) or die(mysql_error()); echo "Processing races…
"; $arr_Races = array(""); $i = 0; while($row = mysql_fetch_array($results)) { $uid = $row[uid]; $name = $row[name]; $swim = $row[swim]; $bike = $row[bike]; if ($row[run] != "") { $run = $row[run]; } else { $run = 0; } $oneunit = $row[oneunit]; $twounit = $row[twounit]; $threeunit = $row[threeunit]; $onetype = $row[onetype]; $twotype = $row[twotype]; $threetype = $row[threetype]; $one_points = 0; $two_points = 0; $three_points = 0; $arrSwimPoints = array(1 => 17.6, 2 => 0.011, 3 => 0.01, 4 => 11); $arrBikePoints = array(1 => 1, 2 => 0.00062, 3 => 0.00057, 4=> .62); $arrRunPoints = array(1 => 4, 2 => 0.0025, 3 => 0.0023, 4 => 2.5); $arrPaddlePoints = array(1 => 2.6667, 2 => 0.00167, 3 => 0.00153, 4 => 1.6667); $arrSkiPoints = array(1 => 2.75, 2 => 0.00172, 3 => 0.00158, 4 => 1.72); $arrMtbPoints = array(1 => 2, 2 => 0.00124, 3 => 0.00114, 4=> 1.24); $arrPoints = array(1 => $arrSwimPoints, 2=> $arrBikePoints, 3 => $arrRunPoints, 4 => $arrPaddlePoints, 5 => $arrSkiPoints); $one_points = $swim*$arrPoints[$onetype][$oneunit]; $two_points = $bike*$arrPoints[$twotype][$twounit]; $three_points = $run*$arrPoints[$threetype][$threeunit]; $points = $one_points + $two_points + $three_points; $points = round($points, 0); //echo ("Race ID: $uid - $one_points / $two_points / $three_points -- $points
"); // throw an error on bad units if ($points > 260) { echo ("Excessive Points. RACE_UID: ".$uid.". ".$name." [".$points." Points]
"); } if ($points != $row[points]) { if ($points < 40) { $pointclass = 1; } elseif ($points >= 40 AND $points < 100) { $pointclass = 2; } elseif ($points >= 100 AND $points < 180) { $pointclass = 3; } else { $pointclass = 4; } $sql_Fix = "UPDATE ".$prefix."Triathlons SET one_points = ".($one_points).", two_points = ".($two_points).", three_points = ".($three_points).", points = ".($points).", pointclass = ".($pointclass)." WHERE uid = ".$uid; mysql_query($sql_Fix) OR die(mysql_error()); echo ("Race #".$uid." updated.
"); } } echo "Done processing races.
"; //header('Location: https://slowtwitch.com/calendar/?tags_cleared='.$tags_cleared.'.php'); ?>