commit
b8105746ab
1 changed files with 7 additions and 4 deletions
|
|
@ -29,9 +29,12 @@ error_reporting(E_ALL);
|
|||
// Display buttons for each player
|
||||
echo "<form method='post' action=''>";
|
||||
foreach ($players_matches as $player_data) {
|
||||
$player_name = $player_data['playername'];
|
||||
echo "<button type='submit' name='selected_player' value='$player_name' class='btn'>$player_name</button>";
|
||||
if (isset($player_data['playername'])) {
|
||||
$player_name = $player_data['playername'];
|
||||
echo "<button type='submit' name='selected_player' value='$player_name' class='btn'>$player_name</button>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "</form><br>";
|
||||
|
||||
$selected_player = $_POST['selected_player'] ?? $players_matches[0]['playername'];
|
||||
|
|
@ -50,14 +53,14 @@ error_reporting(E_ALL);
|
|||
);
|
||||
// Display the player's match stats
|
||||
foreach ($players_matches as $player_data) {
|
||||
if ($player_data['playername'] === $selected_player) {
|
||||
if (isset($player_data['playername']) && $player_data['playername'] === $selected_player) {
|
||||
echo "<h2>Recent Matches for $selected_player</h2>";
|
||||
echo "<table border='1' class='sortable'>";
|
||||
echo "<tr><th>Match Date</th><th>Game Mode</th><th>MatchType</th><th>Map</th><th>Kills</th><th>Damage Dealt</th><th>Time Survived</th><th>winPlace</th></tr>";
|
||||
foreach ($player_data['player_matches'] as $match) {
|
||||
$date = new DateTime($match['createdAt']);
|
||||
$date->modify('+2 hours');
|
||||
$formattedDate = $date->format('d F Y, H:i:s');
|
||||
$formattedDate = $date->format('Y-m-d H:i:s');
|
||||
|
||||
$matchType = $match['matchType'];
|
||||
$gameMode = $match['gameMode'];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue