prepare(' SELECT t.name FROM teams t JOIN match_teams mt ON t.id = mt.team_id WHERE mt.match_id = ? '); $stmt->execute([$match['id']]); $teams = $stmt->fetchAll(PDO::FETCH_COLUMN); $match_date = new DateTime($match['match_datetime']); $formatted_date = $match_date->format('D, M j, Y '); $formatted_time = $match_date->format('g:i A'); $teams_html = ''; if (count($teams) > 0) { $teams_html = '

Teams: ' . htmlspecialchars(implode(', ', $teams)) . '

'; } return '
' . htmlspecialchars($match['match_type']) . '

' . htmlspecialchars($match['location']) . '

' . $formatted_date . ' at ' . $formatted_time . '

' . $teams_html . 'View Details
'; } ?> Matches

Matches

Upcoming

prepare("SELECT * FROM matches WHERE match_datetime > NOW() ORDER BY match_datetime ASC LIMIT 5"); $stmt->execute(); $upcoming_matches = $stmt->fetchAll(); if (count($upcoming_matches) == 0) { echo '

No upcoming matches.

'; } else { foreach ($upcoming_matches as $match) { echo render_match_card($match); } } ?>
prepare("SELECT * FROM matches WHERE match_datetime <= NOW() AND match_datetime >= NOW() - INTERVAL 2 WEEK ORDER BY match_datetime DESC LIMIT 5"); $stmt->execute(); $recent_matches = $stmt->fetchAll(); if (count($recent_matches) > 0): ?>

Last 2 Weeks

prepare("SELECT * FROM matches WHERE match_datetime < NOW() - INTERVAL 2 WEEK ORDER BY match_datetime DESC LIMIT 5"); $stmt->execute(); $past_matches = $stmt->fetchAll(); if (count($past_matches) > 0): ?>

Past Games