Fix trailing whitespace and JSON parse errors on backend

This commit is contained in:
Nama Kamu
2026-06-11 15:02:32 +07:00
parent b008122815
commit 805f152be1
7 changed files with 17 additions and 18 deletions
+7 -4
View File
@@ -5,9 +5,12 @@ $data = [];
$result = $conn->query("SELECT * FROM spbu");
while ($row = $result->fetch_assoc()) {
$data[] = $row;
if ($result) {
while ($row = $result->fetch_assoc()) {
$data[] = $row;
}
} else {
// If table doesn't exist or other error, return empty array
}
echo json_encode($data);
?>
echo json_encode($data);