34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
require("koneksi.php");
|
|
|
|
header('Content-Type:application/json;charset=UTF-8');
|
|
|
|
// $perintah = "SELECT * FROM kasus_testing ORDER BY id_kasus_testing ASC";
|
|
$perintah = "SELECT A.id_kasus_testing, A.tkp, A.jumlah_kejahatan, A.jarak_tkp_polres, A.status, B.name FROM kasus_testing A INNER JOIN user B ON A.id_user = B.id_user ORDER BY A.id_kasus_testing";
|
|
$eksekusi = mysqli_query($koneksi, $perintah);
|
|
$cek = mysqli_affected_rows($koneksi);
|
|
|
|
if ($cek > 0) {
|
|
$response["code"] = 200;
|
|
$response["status"] = "Kasus Testing Tersedia";
|
|
$response["data"] = array();
|
|
|
|
while ($ambil = mysqli_fetch_object($eksekusi)) {
|
|
$F["id_kasus_testing"] = $ambil->id_kasus_testing;
|
|
$F["tkp"] = $ambil->tkp;
|
|
$F["jumlah_kejahatan"] = $ambil->jumlah_kejahatan;
|
|
$F["jarak_tkp_polres"] = $ambil->jarak_tkp_polres;
|
|
$F["status"] = $ambil->status;
|
|
$F["name"] = $ambil->name;
|
|
|
|
array_push($response["data"], $F);
|
|
}
|
|
} else {
|
|
$response["code"] = 400;
|
|
$response["status"] = "Kasus Testing Tidak Tersedia";
|
|
}
|
|
|
|
echo json_encode($response);
|
|
mysqli_close($koneksi);
|