This is my code that I am using to try and calculate the sum of "amountReceived" column. The total for invID '95' should = 312, but for some reason it is only = 300. I am not sure what the issue is. (please see the DB images below).
$sql = mysql_query("SELECT amountReceived FROM payments WHERE invID='".$id."'");
$result = mysql_fetch_array($sql);
$totalPayment = array_sum($result);
$balanceDue = $invoiceTotal - $totalPayment;

