fixes #37
1 changed files with 7 additions and 4 deletions
|
|
@ -29,9 +29,12 @@ error_reporting(E_ALL);
|
||||||
// Display buttons for each player
|
// Display buttons for each player
|
||||||
echo "<form method='post' action=''>";
|
echo "<form method='post' action=''>";
|
||||||
foreach ($players_matches as $player_data) {
|
foreach ($players_matches as $player_data) {
|
||||||
$player_name = $player_data['playername'];
|
if (isset($player_data['playername'])) {
|
||||||
echo "<button type='submit' name='selected_player' value='$player_name' class='btn'>$player_name</button>";
|
$player_name = $player_data['playername'];
|
||||||
|
echo "<button type='submit' name='selected_player' value='$player_name' class='btn'>$player_name</button>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</form><br>";
|
echo "</form><br>";
|
||||||
|
|
||||||
$selected_player = $_POST['selected_player'] ?? $players_matches[0]['playername'];
|
$selected_player = $_POST['selected_player'] ?? $players_matches[0]['playername'];
|
||||||
|
|
@ -50,14 +53,14 @@ error_reporting(E_ALL);
|
||||||
);
|
);
|
||||||
// Display the player's match stats
|
// Display the player's match stats
|
||||||
foreach ($players_matches as $player_data) {
|
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 "<h2>Recent Matches for $selected_player</h2>";
|
||||||
echo "<table border='1' class='sortable'>";
|
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>";
|
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) {
|
foreach ($player_data['player_matches'] as $match) {
|
||||||
$date = new DateTime($match['createdAt']);
|
$date = new DateTime($match['createdAt']);
|
||||||
$date->modify('+2 hours');
|
$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'];
|
$matchType = $match['matchType'];
|
||||||
$gameMode = $match['gameMode'];
|
$gameMode = $match['gameMode'];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue