check for null

This commit is contained in:
Thijs Stobbelaar 2023-09-27 15:57:04 +02:00
parent 295af20eb5
commit b0e4b4a63b

View file

@ -38,7 +38,7 @@ error_reporting(E_ALL);
</tr>"; </tr>";
foreach ($players_matches as $player_data) { foreach ($players_matches as $player_data) {
if (isset($player_data['updated'])) { if (!isset($player_data['playername']) || is_null($player_data['playername'])) {
continue; // Skip this iteration and move to the next continue; // Skip this iteration and move to the next
} }
$player_name = $player_data['playername']; $player_name = $player_data['playername'];
@ -48,8 +48,6 @@ error_reporting(E_ALL);
$matches = $player_data['matches']; $matches = $player_data['matches'];
$KD_H = ($player_data['KD_H'] == "Infinity") ? "" : number_format($player_data['KD_H'], 2, ',', ''); $KD_H = ($player_data['KD_H'] == "Infinity") ? "" : number_format($player_data['KD_H'], 2, ',', '');
$KD_ALL = ($player_data['KD_ALL'] == "Infinity") ? "" : number_format($player_data['KD_ALL'], 2, ',', ''); $KD_ALL = ($player_data['KD_ALL'] == "Infinity") ? "" : number_format($player_data['KD_ALL'], 2, ',', '');
echo $KD_H;
echo $KD_ALL;
echo "<tr> echo "<tr>
<td>$player_name</td> <td>$player_name</td>