query("SELECT * FROM special_programs ORDER BY created_at DESC"); $special_programs = $stmt->fetchAll(PDO::FETCH_ASSOC); if (empty($special_programs)) { echo '

No special programs available.

'; return; } // Get the latest video for the banner $banner_video = $special_programs[0]; // Extract video ID to ensure thumbnail URL is correct $video_id = ''; if (preg_match('/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/', $banner_video['youtube_url'], $match)) { $video_id = $match[1]; } $banner_thumbnail = $video_id ? "https://i.ytimg.com/vi/{$video_id}/maxresdefault.jpg" : 'default.jpg'; // Debug thumbnail URL error_log("Special Program Banner: ID {$banner_video['id']}, Title: {$banner_video['title']}, Thumbnail URL: {$banner_thumbnail}"); ?>
<?php echo htmlspecialchars($banner_video['title']); ?>