Fix uncaught exception causing HTTP 500 in read_pemukiman_miskin.php
This commit is contained in:
@@ -35,7 +35,15 @@ function compute_nearest_ibadah(array $ibadahRows, $lat, $lng) {
|
||||
}
|
||||
|
||||
// Prefer new schema; fall back to old schema if needed.
|
||||
$cols = $pdo->query("SHOW COLUMNS FROM pemukiman_miskin_points")->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||
$cols = [];
|
||||
try {
|
||||
$stmtCols = $pdo->query("SHOW COLUMNS FROM pemukiman_miskin_points");
|
||||
if ($stmtCols) {
|
||||
$cols = $stmtCols->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Jika tabel belum dibuat, abaikan dan kembalikan array kosong
|
||||
}
|
||||
$hasNew = in_array('kk_nama', $cols, true);
|
||||
|
||||
$hasJarak = in_array('jarak_meter', $cols, true);
|
||||
|
||||
Reference in New Issue
Block a user