<?php
// Include your database connection code
require_once 'shikanisha.kts.php';

// Check if client_id is provided and is a valid number
if (isset($_POST['client_id']) && is_numeric($_POST['client_id'])) {
    $client_id = $_POST['client_id'];

    // Your SQL query to delete a client from the customers table
    $sql = "DELETE FROM `customers` WHERE `customer_id` = '$client_id'";

    // Execute the query
    if (mysqli_query($conn, $sql)) {
        // Success message
        echo json_encode(['success' => true, 'message' => 'Client deleted successfully']);
    } else {
        // Error message
        echo json_encode(['success' => false, 'message' => 'Error deleting client: ' . mysqli_error($conn)]);
    }
} else {
    // Invalid input
    echo json_encode(['success' => false, 'message' => 'Invalid input']);
}

// Close the database connection
mysqli_close($conn);
?>
