';
echo "
🔎 Debug: Aktuella grupper för turnering ID $tournament_id
";
$stmt = $conn->prepare("
SELECT groupNumber, player1_id, player2_id
FROM ttranking_matches
WHERE tournament_id = ?
ORDER BY groupNumber ASC, match_id ASC
");
$stmt->bind_param("i", $tournament_id);
$stmt->execute();
$res2 = $stmt->get_result();
$currentGroup = null;
while ($row = $res2->fetch_assoc()) {
if ($row['groupNumber'] !== $currentGroup) {
if ($currentGroup !== null) echo '';
$currentGroup = $row['groupNumber'];
echo "
Pulje " . $currentGroup . "";
}
echo "- Match mellan spelare ID " . $row['player1_id'] . " och " . $row['player2_id'] . "
";
}
if ($currentGroup !== null) echo '
';
echo '
';
$stmt->close();