'index.php']]; require_once('components/banner.php'); ?> Trips available CURDATE()"; $result = $conn->query($sql); if ($result->num_rows > 0) { // Loop through each row while ($row = $result->fetch_assoc()) { $trip_id = $row['trip_id']; $trip_name = $row['trip_name']; $location = $row['location']; $short_description = $row['short_description']; $start_date = $row['start_date']; $end_date = $row['end_date']; $capacity = $row['vehicle_capacity']; $cost_members = $row['cost_members']; $places_booked = $row['places_booked']; $remaining_places = getAvailableSpaces($trip_id); // Determine the badge text based on the status $badge_text = ($remaining_places > 0) ? $remaining_places.' PLACES LEFT!!' : 'FULLY BOOKED'; // Output the HTML structure with dynamic data echo ' ' . $badge_text . ' ' . $location . ' ' . $trip_name . ' ' . $short_description . ' ' . convertDate($start_date) . ' - ' . convertDate($end_date) . ' '.calculateDaysAndNights($start_date, $end_date).' ' . $capacity . ' vehicles max '; } } // Close connection $conn->close(); ?>
' . $short_description . '