<?php
include('../connection.php');

$query = "SELECT * FROM line_man";
$result = $conn->query($query);

if ($result->num_rows > 0) {
    $ticketData = array();
    while ($row = $result->fetch_assoc()) {
        $response[] = [
                'id' => $row['id'],
                'name' => $row['name'],
                'phone' => $row['phone'],
        ];
    }
} else {
    // Step 5: Prepare the failure response
    $response = [
        'status' => 'error',
        'message' => 'No data found',
    ];
}
header('Content-Type: application/json');
echo json_encode($response);

// Step 7: Close the database connection
$conn->close();
?>
