<?php
include "koneksi.php";
$response = array();
if (isset($_GET['id_pengguna'])) {
	$query = mysqli_query($koneksi, "SELECT * FROM keluhan WHERE id_pengguna='" . $_GET['id_pengguna'] . "'
  AND status_pengguna=0 AND NOT balasan='' ORDER BY id_keluhan DESC LIMIT 1");
	if ($row = mysqli_fetch_array($query)) {
		$output = array();
		$response["id_pengguna"] = $row["id_pengguna"];

		$response["pesan"] = "Ada balasan baru dari admin KSP Dana Arta Mandiri atas keluhan anda";

		$query2 = "UPDATE keluhan SET status_pengguna=1 WHERE id_keluhan='" . $row['id_keluhan'] . "'";
		$result2 = mysqli_query($koneksi, $query2);
	} else {
		$response["id_pengguna"] = -1;
		$response["pesan"] = "";
	}
}
echo json_encode($response);
