<?php
include '../opendb.php';

if (isset($_GET['id'])) {
    $id = intval($_GET['id']); 

    $sql = "DELETE FROM testimonials WHERE id = $id";

    if (mysqli_query($conn, $sql)) {
        echo "<script>alert('Testimonial deleted successfully'); window.location.href='testimonial.php';</script>";
    } else {
        echo "Error deleting record: " . mysqli_error($conn);
    }
} else {
    echo "Invalid request.";
}

mysqli_close($conn);
?>
