<?php

if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['delete'])) {
    deleteRecords();
}

function deleteRecords() {
    // Establish your database connection
    $db_host = 'localhost';
    $db_name = 'shangrilaperfumes';
    $db_user = 'root';
    $db_pass = '';

    $conn = new mysqli($db_host, $db_user, $db_pass, $db_name);

    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }

    // Query to delete all records from 'text_table'
    $sql = "DELETE FROM test_table";

    if ($conn->query($sql) === TRUE) {
        // Deletion successful
        echo "All Records deleted successfully";
    } else {
        // Error during deletion
        echo "Error: " . $conn->error;
    }

    // Close the database connection
    $conn->close();
}

?>
