<?php
require_once __DIR__ . '/../config/db.php';

header('Content-Type: application/json; charset=utf-8');

try {
    $places = db()->query("SELECT id, name_ar, category, lat, lng, is_active FROM places WHERE is_active=1")->fetchAll();
    echo json_encode(['ok' => true, 'count' => count($places), 'places' => $places]);
} catch (Exception $e) {
    echo json_encode(['ok' => false, 'error' => $e->getMessage()]);
}
