<?php
// get_dim_enot_info_window.php

header('Content-Type: application/json');
require_once __DIR__ . '/db.php';

$sql = "SELECT id, onoma FROM dimotiki_enotita ORDER BY onoma";
$stmt = $pdo->query($sql);

$out = [];
while ($r = $stmt->fetch(PDO::FETCH_ASSOC)) {

    $out[$r['id']] = htmlspecialchars($r['onoma'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
}

echo json_encode($out, JSON_UNESCAPED_UNICODE);
