I once having problem dealing with number on Server events on Custom button but manage to make any number Value to String (using ''). But I get problem dealing with float/Double Type attributes.
I usually do this to fix the Sql problem(Insert, Update or Delete):
foreach($keys as $idx=>$val)
{
$sql = "Update transaction Set Order_ID= '" . $val["Generated_ID"] . "' where Reference_Code = '" . $val["Reference_Code"] . "'";
CustomQuery($sql);
}
If you notice, the Order_ID is set to String ('$val["Generated_ID"]') with single quotes. That fixes my problem. Success. But:
When trying to update customer balance, my fixing trick won't work anymore:
foreach($keys as $idx=>$val)
{
$sql = "Update Customer Set Balance = Balance + '" . $val["Amount"] . "' where Customer_ID = '" . $val["Customer_ID"] . "'";
CustomQuery($sql);
}
The above query doesn't update my customer Balance and have no errors. If I will NOT use the singles quotes ('" . $val["Amount"] . "') it then throw exception JSON.parse
I even tried floatval($val["Amount"]) but still won't update.