prepare($sql . " AND category = ? ORDER BY created_at DESC"); $stmt->execute([$active_category]); } else { $stmt = $pdo->query($sql . " ORDER BY created_at DESC"); } $videos = $stmt->fetchAll(PDO::FETCH_ASSOC); // Get categories with counts $categories = $pdo->query("SELECT category, COUNT(*) as count FROM video_gallery WHERE status='active' GROUP BY category ORDER BY category")->fetchAll(PDO::FETCH_ASSOC); // Get total active videos count $total_active = $pdo->query("SELECT COUNT(*) FROM video_gallery WHERE status='active'")->fetchColumn(); // Get featured videos $featured_stmt = $pdo->query("SELECT * FROM video_gallery WHERE status='active' AND featured=1 ORDER BY created_at DESC LIMIT 3"); $featured_videos = $featured_stmt->fetchAll(PDO::FETCH_ASSOC); $page_title = ($active_category != 'all') ? htmlspecialchars($active_category) . " Videos" : "Video Gallery"; } catch (Exception $e) { $videos = []; $categories = []; $total_active = 0; $featured_videos = []; $page_title = "Video Gallery"; } ?>
Watch educational content, campus events, student activities, and more
Handpicked content for you
video available