query($trips_query); $trips = []; if ($result && $result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $trips[] = $row; } } ?>
Create New Trip
0) { echo ''; echo '
'; echo '
'; echo ''; foreach ($trips as $trip) { $publishButtonText = $trip['published'] == 1 ? 'Unpublish' : 'Publish'; $publishButtonClass = $trip['published'] == 1 ? 'btn-warning' : 'btn-success'; echo ''; } echo '
Trip Name Location Start Date End Date Capacity Booked Cost (Member) Status Actions
' . htmlspecialchars($trip['trip_name']) . ' ' . htmlspecialchars($trip['location']) . ' ' . date('M d, Y', strtotime($trip['start_date'])) . ' ' . date('M d, Y', strtotime($trip['end_date'])) . ' ' . $trip['vehicle_capacity'] . ' ' . $trip['places_booked'] . ' / ' . $trip['vehicle_capacity'] . ' R ' . number_format($trip['cost_members'], 2) . ' ' . ($trip['published'] == 1 ? 'Published' : 'Draft') . '
'; echo '
'; echo '
'; } else { echo '

No trips found. Create one

'; } ?>