I have the following code:
// delete record
$sql = "DELETE FROM MyGuests WHERE id=4";
mysqli_query($conn, $sql);
if (mysqli_affected_rows($conn) > 0) {
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . mysqli_error($conn);
}
My question is I am not getting the error message via mysql_error($conn) when there is no guests record for ID = 4.
Below is the test output:
-------------------------------
id: 1 - Name: Mary Moe1
id: 2 - Name: Mary Moe2
id: 36 - Name: Mary Moe3
Error deleting record:
Kindly advise the necessary. Thank you.