<?php
include 'koneksi.php';

$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;

$query = mysqli_query($koneksi, "SELECT * FROM arsip_statis WHERE id = '$id'");
$data = mysqli_fetch_array($query);

if($data) {
    echo json_encode([
        'success' => true,
        'judul' => htmlspecialchars($data['judul']),
        'tahun' => $data['tahun'],
        'nomor' => $data['nomor'],
        'isi' => nl2br(htmlspecialchars($data['isi_arsip'] ?: $data['keterangan']))
    ]);
} else {
    echo json_encode(['success' => false]);
}
?>