im sending id of the row as scanID, setting table name, item, value in PHP and calling out the model to update the specific row, the query is working perfectly but the row is not updating.
trying to change status from 0 to 1 as item = column and value = 1.
PHP Code
if(isset($_POST["scanID"])){
$table = 'scan-start';
$item1 = 'scanStatus';
$value1= 1;
$value=$_POST["scanID"];
$answer = CalloutModel::mdlUpdateScanStatus($table, $item1, $value1, $value);
}
Model
static public function mdlUpdateScanStatus($table, $item1, $value1, $value){
$stmt = Connection::connect()->prepare("UPDATE `$table` SET $item1 = :$item1 WHERE id = :id");
$stmt -> bindParam(":".$item1,$value1, PDO::PARAM_STR);
$stmt -> bindParam(":id",$value, PDO::PARAM_STR);
if($stmt -> execute()){
return $stmt->rowCount();
}else{
return "error";
}
$stmt -> close();
$stmt = null;
}
rowCount() is returning 0.. I know I'm missing something small, tried changing value to string but no luck, any help would be greatly appreciated.