Initial commit: Upload project WebGIS dengan tema Merah Putih
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
include '../koneksi.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$id = (int)($_GET['id'] ?? 0);
|
||||
if (!$id) { echo json_encode(['status'=>'error','message'=>'ID tidak valid.']); exit; }
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("SELECT * FROM fasilitas_publik WHERE id=?");
|
||||
$stmt->execute([$id]);
|
||||
$data = $stmt->fetch();
|
||||
if ($data) {
|
||||
echo json_encode(['status'=>'success','data'=>$data]);
|
||||
} else {
|
||||
echo json_encode(['status'=>'error','message'=>'Data tidak ditemukan.']);
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo json_encode(['status'=>'error','message'=>$e->getMessage()]);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user