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['location']) . '
' . $formatted_date . ' at ' . $formatted_time . '
' . $teams_html . 'View DetailsNo upcoming matches.
'; } else { foreach ($upcoming_matches as $match) { echo render_match_card($match); } } ?>