Fix trailing whitespace and JSON parse errors on backend
This commit is contained in:
+7
-4
@@ -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);
|
||||
Reference in New Issue
Block a user