From 80ff3443cd41686b820dee9b54cf1489313c1463 Mon Sep 17 00:00:00 2001 From: mhmmadbayuu Date: Fri, 12 Jun 2026 18:50:51 +0700 Subject: [PATCH] Fix uncaught exception causing HTTP 500 in read_pemukiman_miskin.php --- webgis-spbu/php/read_pemukiman_miskin.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/webgis-spbu/php/read_pemukiman_miskin.php b/webgis-spbu/php/read_pemukiman_miskin.php index bc5b48b..0dfaeda 100644 --- a/webgis-spbu/php/read_pemukiman_miskin.php +++ b/webgis-spbu/php/read_pemukiman_miskin.php @@ -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);