I'm trying to pull a decimal from my database, but when I try it's trying to make it an int and I don't know how to fix it because I'm stupid and I don't even deserve to be called a programmer. Can someone please help?
if (isset($_POST['Add'])) {
$Date = $_POST['Date'];
$Amount = $_POST['Amount'];
$LegalFees = 0.00;
$CheckID = $_POST['Check_ID'];
$DateAdded = date("Y/m/d", strtotime($_POST['Date']));
$result = mysqli_query($conn, "SELECT CheckID FROM checks WHERE CheckID='" . $CheckID . "'");
$CurrentPayment = mysqli_query($conn, "SELECT payments FROM checks WHERE CheckID='" . $CheckID . "'");
$TotalPayment = $Amount + $CurrentPayment;
if (mysqli_num_rows($result) > 0) {
$sqlinsert = $conn->query("INSERT INTO payments (Date,Amount,LegalFees,CheckID)Values('{$DateAdded}','{$Amount}','{$LegalFees}','{$CheckID}')");
$sqlupdate = $conn->query("UPDATE checks SET payments=" . $TotalPayment . " WHERE checkID=" . $CheckID . "");
} else {
$_SESSION["CheckIDFail"] = "Yes";
}
}
So basically it's supposed to select the payment in the db which is a decimal and store it into $CurrentPayment, but it can't because it's trying to make the decimal an int.
The rest of the code I don't really have a problem with, it works as it should. Just need to know how to make it pull a decimal correctly. I think it has to do with fetch or something? I don't know, someone please help this pathetic person?