<?php

			include('database.php');
			DB_connexion(); 

function chessmaster()
{		
			$chessmaster_mode = true;
			
			if($chessmaster_mode == true)
			{
				$J1_nom = "un";
				$sql = "SELECT * FROM chessmaster WHERE joueur = '$J1_nom' ";
				$results = mysql_query($sql);
				$J1_datas = mysql_fetch_assoc($results);
			
				echo "<pre>";
				print_r($J1_datas);
						
				$J2_nom = "deux";
				$sql = "SELECT * FROM chessmaster WHERE joueur = '$J2_nom' ";
				$results = mysql_query($sql);
				$J2_datas = mysql_fetch_assoc($results);
			
				echo "<pre>";
				print_r($J2_datas);
						
				if($resultat == 1)
				{
					$_score_blanc = 1;
					$_score_noir = 0;
					if($J1_datas['master'] == "yes" && $J2_datas['master'] == "no")
					{
						$J1 = "add_victory";
						$J2 = "none";
					}
					if($J1_datas['master'] == "no" && $J2_datas['master'] == "yes")
					{
						$J1 = "win";
						$J2 = "loss";
					}
				}

				if($resultat == 2)
				{
					$_score_blanc = 0;
					$_score_noir = 1;	
					if($J1_datas['master'] == "yes" && $J2_datas['master'] == "no")
					{
						$J1 = "loss";
						$J2 = "win";
					}	
					if($J1_datas['master'] == "no" && $J2_datas['master'] == "yes")
					{
						$J1 = "none";
						$J2 = "add_victory";
					}	
				}
			
				
			
				//$sql = "INSERT INTO chessmaster (w_name, b_name, result, master, history, date) VALUES ('$champ_nom','$elo')";
			}
				
}		


			$tab_partie = array();
			
			$tab_partie[0] = "un";
			$tab_partie[1] = "deux";
		    $tab_partie[2] = "1";
			$tab_partie[5] = "date";
			$tab_store[] =  $tab_partie;
			
			$tab_partie[0] = "un";
			$tab_partie[1] = "deux";
		    $tab_partie[2] = "1";
			$tab_partie[5] = "date";
			$tab_store[] =  $tab_partie;
			
			$tab_partie[0] = "un";
			$tab_partie[1] = "deux";
		    $tab_partie[2] = "1";
			$tab_partie[5] = "date";
			$tab_store[] =  $tab_partie;
			
			$tab_partie[0] = "un";
			$tab_partie[1] = "deux";
		    $tab_partie[2] = "1";
			$tab_partie[5] = "date";
			$tab_store[] =  $tab_partie;
			
			

			echo "<pre>";
			print_r($tab_store);		
			//$sql = "INSERT INTO chessmaster (w_name, b_name, result, master, history, date) VALUES ('$champ_nom','$elo')";
			//$results = mysql_query($sql);
			
			//chessmaster();


?>