How can one effectively check if an Update/Delete/Select operation was successful in PHP?

To effectively check if an Update/Delete/Select operation was successful in PHP, you can use the mysqli_affected_rows() function to determine the number of affected rows by the last query. If the value returned is greater than 0, then the operation was successful.

// Perform an update/delete/select operation
$query = "UPDATE table SET column = 'value' WHERE condition";
$result = mysqli_query($connection, $query);

// Check if the operation was successful
if(mysqli_affected_rows($connection) > 0) {
    echo "Operation was successful.";
} else {
    echo "Operation was not successful.";
}