<?php
// db.php
$host = 'localhost';
$port = 5432;
$dbname = 'postgres';
$user = 'dimoi_accessibility';
$pass = 'postgresse!';

try {
    $pdo = new PDO("pgsql:host=$host;port=$port;dbname=$dbname", $user, $pass);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e){
    die("Σφάλμα σύνδεσης βάσης: " . $e->getMessage());
}

// Φόρτωση δήμων
$stmt = $pdo->query("SELECT id, xcomments FROM dimos ORDER BY xcomments ASC");
$dimos_list = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
