";
for ($i=0; $i < $nb_parties; $i++)
{
if($i != $id_partie )
{
$new_table_parties[] = $table_parties[$i];
//echo $i ."
";
}
}
//echo "
"; //print_r($new_table_parties); //echo "
"; // extraire les joueurs $joueur = array(); //$sql = "SELECT * FROM classement ORDER by joueur asc"; $sql = "SELECT * FROM " .$_SESSION['classement'] ." ORDER by joueur asc"; $results = mysql_query($sql); while($row = mysql_fetch_assoc($results)) { $joueur[] = $row['joueur']; } // effacer les tables //mysql_query('TRUNCATE TABLE classement;'); //mysql_query('TRUNCATE TABLE evolution;'); //mysql_query('TRUNCATE TABLE parties;'); //mysql_query('TRUNCATE TABLE chessmaster;'); $str1 = "TRUNCATE TABLE " .$_SESSION['classement']; $str2 = "TRUNCATE TABLE " .$_SESSION['evolution']; $str3 = "TRUNCATE TABLE " .$_SESSION['parties']; $str4 = "TRUNCATE TABLE " .$_SESSION['chessmaster']; mysql_query($str1); mysql_query($str2); mysql_query($str3); mysql_query($str4); stockage_joueurs_DB($joueur); for ($item=0; $item < count($new_table_parties) ; $item++) { $donnees[0] = $new_table_parties[$item][0]; $donnees[1] = $new_table_parties[$item][1]; $donnees[2] = $new_table_parties[$item][2]; $donnees[3] = $new_table_parties[$item][3]; $donnees[4] = $new_table_parties[$item][4]; $indice = $item + 1; //echo ""; //print_r($donnees); //echo "
"; algo_elo($donnees, "nostatistique", "sql", $indice ); chess_master($donnees,$indice); } echo 1; function transfert_DB() { //$sql = "SELECT * FROM parties ORDER by date asc"; $sql = "SELECT * FROM " .$_SESSION['parties'] ." ORDER by date asc"; $results = mysql_query($sql); $nb_parties = mysql_num_rows($results); while($row = mysql_fetch_assoc($results)) { $blanc = $row['w_name']; $noir = $row['b_name']; $timestamp = $row['date']; $resultat = $row['result']; if($resultat == 1) { $_score_blanc = 1; $_score_noir = 0; } if($resultat == 2) { $_score_blanc = 0; $_score_noir = 1; } if($resultat == 3) { $_score_blanc = 0.5; $_score_noir = 0.5; } $table_csv[0] = $timestamp; $table_csv[1] = $blanc; $table_csv[2] = $noir; $table_csv[3] = $_score_blanc; $table_csv[4] = $_score_noir; $table_fichier[] = $table_csv; } $retour[] = $nb_parties; $retour[] = $table_fichier; return($retour); } ?>