<?php

require_once "conn.php";

$stmt = $conn->prepare("SELECT id, tahun, Kd_Akun, Kd_Keg, Kd_rincian, Nilai_Anggaran, Nilai_Realisasi FROM keuangan_manual_rinci;");

$stmt->execute();
$stmt->bind_result($id, $tahun, $jenis, $kegiatan, $rincian, $anggaran, $realisasi);

$keuangan = array();

while($stmt->fetch()){
    $temp = array();
    $temp['id'] = $id;
    $temp['tahun'] = $tahun;
    $temp['jenis anggaran'] = $jenis;
    $temp['kegiatan'] = $kegiatan;
    $temp['rincian'] = $rincian;
    $temp['anggaran'] = $anggaran;
    $temp['realisasi'] = $realisasi;

    array_push($keuangan, $temp);
}

echo json_encode($keuangan);