User Dashboard
Welcome, !
This is your user dashboard. You can view available competitions below.
query('SELECT id, title, description, start_date FROM competitions ORDER BY start_date ASC'); $competitions = $stmt->fetchAll(PDO::FETCH_ASSOC); // Fetch competitions the user has joined $stmt = $pdo->prepare('SELECT competition_id FROM competition_participants WHERE user_id = ?'); $stmt->execute([$user_id]); $joined_competitions = $stmt->fetchAll(PDO::FETCH_COLUMN, 0); // Fetch user's submissions $stmt = $pdo->prepare('SELECT competition_id, file_path, uploaded_at FROM competition_submissions WHERE user_id = ?'); $stmt->execute([$user_id]); $submissions = $stmt->fetchAll(PDO::FETCH_GROUP | PDO::FETCH_ASSOC); } catch (PDOException $e) { $competitions = []; $db_error = "Failed to load competitions."; } ?>
This is your user dashboard. You can view available competitions below.