<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
include '../connection.php';
$sql = "SELECT id, name, icon FROM tbl_service_type ORDER BY name ASC";
$result = $conn->query($sql);

$serviceTypes = [];

if ($result && $result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        $serviceTypes[] = $row;
    }
    echo json_encode(["success" => true, "services_types" => $serviceTypes]);
} else {
    echo json_encode(["success" => false, "message" => "No service found"]);
}

$conn->close();
?>