Jump to content

not doin math right!


TimUSA

Recommended Posts

sorry for the double post, can this please be deleted in the math board?

When this submits to the database, it is not calculating $points correctly???

 

// CONFIGURATION SECTION
$times = $_POST['boats'];
$x = 0;

///POST TO DATABASE
if (isset($_POST['submitted'])) {

if ($_POST['points'][$x] == "DNF")
$points = ($_POST['boats'] +1) * $_POST['factor'];

else if ($_POST['points'][$x] == "DNS")
$points = ($_POST['boats'] +1) * $_POST['factor'];

else
$points = $_POST['points'][$x] * $_POST['factor'];

if ($_POST['factor'] == "3") {
while ($x < $times) {
mysql_query("INSERT INTO `ladder_points` (`memberName`, `raceDate`, `factor`, `racePoints`, `matchPoints`)
              VALUES
             ('{$_POST['name'][$x]}','{$_POST['date']}','{$_POST['factor']}','{$_POST['points'][$x]}','{$points}')
             ");
$x++;
}
} else {
while ($x < $times) {
mysql_query("INSERT INTO `ladder_points` (`memberName`, `raceDate`, `factor`, `racePoints`, `fleetPoints`)
              VALUES
             ('{$_POST['name'][$x]}','{$_POST['date']}','{$_POST['factor']}','{$_POST['points'][$x]}','{$points}')
             ");
$x++;
}
}
}

Link to comment
https://forums.phpfreaks.com/topic/83805-not-doin-math-right/
Share on other sites

Archived

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

×
×
  • 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.