<?php
include 'layouts/dbconn.php';

if (isset($_GET['customer_id'])) {
    $customer_id = intval($_GET['customer_id']);
    $query = "SELECT * FROM customers WHERE customer_id = ?";
    $stmt = $conn->prepare($query);
    $stmt->bind_param('i', $customer_id);
    $stmt->execute();
    $result = $stmt->get_result();

    $customer = $result->fetch_assoc();

    echo json_encode($customer);
} else {
    echo json_encode([]);
}

$conn->close();
?>
