Why would my total price column always update with a number 2?
Do you have any insight as to why my code for updating on an AJAX call would always populate my Total Price column with a Number 2. Even when I explicitly write in an amount, it updates with a '2.00'. Below is the update code and the Ajax function:
<?php
$q = $_GET['q'];
$OptIDhid = $_GET["OptIDhid"];
$OptTotalPrice = $_GET["OptTotalPrice"];
?>
<?php
if (true) {
$UpdateQuery = new WA_MySQLi_Query($convacc_cx);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "cac_quote_new_optionals";
$UpdateQuery->bindColumn("quantity", "i", "". $q ."", "WA_BLANK");
$UpdateQuery->bindColumn("totalprice", "d", "". number_format(100.55,2) ."", "WA_BLANK");
$UpdateQuery->addFilter("optional_id", "=", "i", "". $OptIDhid ."");
$UpdateQuery->execute();
}
?>
// AJAX CALL
<script>
function changeOptsQty(str,optid,c) {
if (str == "") {
//document.getElementById("TotalOptsPrice").innerHTML = "";
return;
} else {
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
//document.getElementById("TotalOptsPrice").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","changeOptsQty.php?q="+str + "&OptIDhid="+ optid + "&OptTotalPrice="+ c ,true);
xmlhttp.send();
}
}
</script>
I put a random number (with decimal or no decimal places "100.55". It is originally $OptTotalPrice but I still get '2.00' in column.
Thanks for any insight into this.