I have a query that updates a record on my database, it works fine but i wanted to know how to check if the update has happened so i can return true and display the right message?
Now i know with a SELECT query i can do:
if(stmt->fetch())
If that is true i return true and saying "records found" but i haven't got a clue how to do it for an update query?
Anyone know how to?
$query = "UPDATE user
SET password = ?
WHERE email = ?";
if($stmt = $conn->prepare($query))
{
$stmt->bind_param('ss', $pwd, $userEmail);
$stmt->execute();
//Check if update worked
}
Thanks for the help.
check if below works:
$query = "UPDATE user
SET password = ?
WHERE email = ?";
if($stmt = $conn->prepare($query)) {
$stmt->bind_param('ss', $pwd, $userEmail);
if ($stmt->execute()) {
// Worked...
} else {
// Didn't work...
}
}