1st commit: version 1.0 WebGis-Pemetaan-Kemiskinan
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
header("Content-Type: application/json; charset=UTF-8");
|
||||
require_once '../koneksi.php';
|
||||
|
||||
$id_penduduk = isset($_GET['id']) ? intval($_GET['id']) : 0;
|
||||
if ($id_penduduk > 0) {
|
||||
try {
|
||||
$stmt = $conn->prepare("SELECT * FROM anggota_keluarga WHERE id_penduduk = :id ORDER BY id ASC");
|
||||
$stmt->bindValue(':id', $id_penduduk, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
} catch(PDOException $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode(["error" => $e->getMessage()]);
|
||||
}
|
||||
} else {
|
||||
http_response_code(400); echo json_encode(["error" => "ID tidak valid"]);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user