query('SELECT title, start_time AS start, end_time AS end FROM bookings'); $bookings = $stmt->fetchAll(PDO::FETCH_ASSOC); $events = []; foreach ($bookings as $booking) { if ($booking['title'] === 'Buffer') { $booking['color'] = 'red'; } else { $booking['color'] = '#3788d8'; // FullCalendar default blue } $events[] = $booking; } header('Content-Type: application/json'); echo json_encode($events); } catch (PDOException $e) { http_response_code(500); echo json_encode(['error' => $e->getMessage()]); }