Initial commit untuk UAS SIG
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
// backend/read_miskin.php
|
||||
header('Content-Type: application/json');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
require_once __DIR__ . '/koneksi.php';
|
||||
|
||||
$conn = getConnection();
|
||||
$result = $conn->query("SELECT id, nama_kk, keterangan, latitude, longitude FROM penduduk_miskin ORDER BY id DESC");
|
||||
|
||||
$data = [];
|
||||
if ($result && $result->num_rows > 0) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$row['latitude'] = (float) $row['latitude'];
|
||||
$row['longitude'] = (float) $row['longitude'];
|
||||
$data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(['success' => true, 'count' => count($data), 'data' => $data]);
|
||||
$conn->close();
|
||||
Reference in New Issue
Block a user