<?php
session_start();
require_once("ConnexionBDD.php");
$db = new MyDB();

$id=$_SESSION['idpartie'];
$requete ="DELETE FROM partieScore where IdPartie='".$id."'";
$suppression = $db->query($requete);

$newid=genererChaineAleatoire(10);
$_SESSION['idpartie']=$newid;
$db->query('INSERT INTO partieScore(IdPartie) VALUES("'.$newid.'")');

$requete2 ="DELETE FROM partieCartes where IdPartie='".$id."'";
$suppression2 = $db->query($requete2);

for ($i = 1; $i <= 16; $i++) {
    $db->query('INSERT INTO partieCartes(IdPartie,IdCarte) VALUES("'.$newid.'","'.$i.'")');
}

