How can I modify my PHP script to send an email when a "delete from" operation is executed?

To send an email when a "delete from" operation is executed in a PHP script, you can use PHP's mail() function to send an email notification. You can place this mail() function call right after the "delete from" operation in your script to ensure that an email is sent whenever a deletion occurs.

<?php
// Perform the delete operation
$query = "DELETE FROM your_table WHERE condition";
$result = mysqli_query($connection, $query);

// Check if the delete operation was successful
if ($result) {
    // Send an email notification
    $to = "recipient@example.com";
    $subject = "Record Deleted";
    $message = "A record has been deleted from your_table.";
    $headers = "From: your_email@example.com";
    
    mail($to, $subject, $message, $headers);
} else {
    echo "Error deleting record: " . mysqli_error($connection);
}
?>