The problem I just got is,
the $update_stmt->execute()
is ok, and data in database already update
but, $update_resultrow = $update_stmt->num_rows;
return 0 ?
I tried to copy MySQL command to run in query and it also worked well, like this:
UPDATE ACCOUNT_EMPLOYEE SET NAME = 'cccccc' WHERE ID = 1
Problem's Code here:
$update_sql = "UPDATE ACCOUNT_EMPLOYEE SET NAME = ? WHERE ID = ?";
if ($update_stmt = $conn -> prepare($update_sql)) {
if ($update_stmt->bind_param("si",
$newname,
$acc_id
)
) {
if ($update_stmt->execute()) {
// must declare here to be able to get num_rows
$update_stmt->store_result();
$update_resultrow = $update_stmt->num_rows;
if ($update_resultrow == 0) {
echo $error_forgot_noresult . '????' . $acc_id ;
$update_stmt->close();
$conn->close();
exit();
}
}
}
}