<?php
include 'includes/db.php';

$einheit = $_GET['einheit'] ?? '';

$stmt = $conn->prepare("SELECT * FROM users WHERE einheit = ? LIMIT 1");
$stmt->bind_param("s", $einheit);
$stmt->execute();
$result = $stmt->get_result();
$data = $result->fetch_assoc();

echo json_encode(['gemeinde' => $data['gemeinde'] ?? '']);
