Trying to learn object oriented programming with php but php pdo update query not working properly,
it gives me no error message and the table does not update.
Works perfectly when i try to select or insert into the database but update not working.
How can I solve this issue please help, thank you so much.
UPDATE LINK FROM INDEX VIEW
<a href='userupdate?exampleInputName=$row[a_name]&exampleInputPhone=$row[a_mobile]'>UPDATE</a>
CONTROLLER PAGE
<?php
include "MdlUsers.cls.php";
class CtrlUsers extends MdlUsers {
// update data controller
public function updateFormUsers($name_data, $number_data) {
$this->updtFormUsers($name_data, $number_data); // from model
echo "Successfully updated";
}
} ?>
MODEL PAGE
<?php
include "Dbh.cls.php";
class MdlUsers extends Dbh {
// update data model
protected function updtFormUsers($name_data, $number_data) {
$sql = "UPDATE reg_tbl SET a_name='$name_data' WHERE a_mobile='$number_data'";
$stmt = $this->connect()->prepare($sql);
// print_r($stmt);
$stmt->execute([$name_data, $number_data]);
}
} ?>