query($sql); $data_spbu = array(); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $data_spbu[] = $row; } } // Kirim data sebagai JSON echo json_encode($data_spbu); $conn->close(); ?>