tfgyifunydrigdrhgerhgiuhgudriughdriuh diu h iuehiurhgiushbuguheiug hdiubh debh dxhbdeh kuse

This commit is contained in:
2026-03-02 08:29:51 +01:00
parent c5cacab0fe
commit 956c8673a6
2 changed files with 8 additions and 4 deletions
+4
View File
@@ -10,6 +10,10 @@ header('Content-Type: application/json');
if ($game_id) {
$stmt = $db->prepare("DELETE FROM games WHERE id = ?");
$stmt->execute([$game_id]);
// Supprimer les joueurs associés à la partie
$stmt = $db->prepare("DELETE FROM players WHERE game_id = ?");
$stmt->execute([$game_id]);
} else {
echo "Aucune partie à supprimer.";
exit;
+4 -4
View File
@@ -59,7 +59,7 @@ foreach ($players as $p) {
<div class="stats-bar">
<div class="stat-item">POT TOTAL: <strong id="main-pot"><?php echo $game['pot'] ?? 0; ?></strong> 🪙</div>
<div class="stat-item">MISE ACTUELLE: <strong id="current-bet"><?php echo $game['last_bet'] ?? 0; ?></strong></div>
<button onclick="deleteGame(<?php echo $game_id; ?>)" class="btn-back">Fermer la table</button>
<button onclick="deleteGame()" class="btn-back">Fermer la table</button>
<button onclick="changePlayer()" class="btn-back">Joueur suivant</button>
<a href="index.php" class="btn-back">⬅ Quitter</a>
</div>
@@ -305,11 +305,11 @@ foreach ($players as $p) {
});
}
function deleteGame(idPartie) {
function deleteGame() {
if (confirm("Supprimer la partie ?")) {
let formData = new FormData();
formData.append('game_id', idPartie);
console.log("Suppression de la partie ID:", idPartie);
formData.append('game_id', actualGameID);
console.log("Suppression de la partie ID:", actualGameID);
fetch('delete_game.php', { method: 'POST', body: formData })
.then(() => window.location.href = 'index.php');