I am trying to run a very simple update query which works in itself when the values are hardcoded in but which doesn't work when I try to pass the ID of the app dynamically. I have a .json object that passes data along, together with the ID of the app. Other similar code in the project works. The javascript function works as the success part returns an appropriate message but the db does not update. Advice on why this may not be passing through? Also, is there a way to "console log" in php what ID it's trying to pass to the query?
Here's the code:
<?
date_default_timezone_set("America/Boise");
$time = array('current_datetime'=>date('Y-m-d H:i:s'));
$inputs = json_decode(file_get_contents("php://input"));
include '../databases.php';
$db_object = new database();
// start a secure session
$db_object->secureSessionStart('__dpc_session');
try {
// check if admin
$db_object->permissionCheck(1);
$con = $db_object->connect();
// sanitize inputs
$cleanInputs = $db_object->sanitize($inputs);
// create sql
$sql = "UPDATE applications SET enr1 = ?, enrName1 = ?, enr2 = ?, enrName2 = ? WHERE id = ? LIMIT 1";
// store in database
$db_object->genericSql($sql, ['i', 's', 's', 's', 's'], [$cleanInputs->id, $cleanInputs->enr1, $cleanInputs->enrName1, $cleanInputs->enr2, $cleanInputs->enrName2]);
} catch (Exception $e) {
http_response_code(401);
print_r(json_encode(array('error'=>$e->getMessage()), JSON_UNESCAPED_UNICODE));
exit;
}