prepare("SELECT id, status FROM sessions WHERE session_code = ?"); $stmt->execute([$session_code]); $session = $stmt->fetch(); if (!$session || $session['status'] !== 'active') { header("Location: index.php?error=invalid_session"); exit(); } $session_id = $session['id']; $stmt = $pdo->prepare("SELECT * FROM queue_items WHERE session_id = ? ORDER BY votes DESC, created_at ASC"); $stmt->execute([$session_id]); $queue_items = $stmt->fetchAll(); } catch (PDOException $e) { // In a real app, you'd log this error, not show it to the user. die("Database error. Please check configuration."); } ?>
Be the first to add a song and get the party started!