<?php

	include('database.php');
	DB_connexion(); 
	
	$J1 = "henrique";
	$J2 = "franckdc";
		
	$sql = "SELECT * FROM parties WHERE w_name = '".$J1."'  and b_name =  '".$J2."' or w_name = '".$J2."'  and b_name =  '".$J1."' "   ;
	$results = mysql_query($sql);
	$nombre = mysql_num_rows($results);
	echo "Nombre de réponses: "  .$nombre;
	
	$sql = "SELECT * FROM parties WHERE w_name = '".$J2."'  and b_name =  '".$J1."'  "   ;
	$results = mysql_query($sql);
	$nombre = mysql_num_rows($results);
	echo "Nombre de réponses: "  .$nombre;
/*
	$sql = "SELECT * FROM partie WHERE joueur1 = '".$J1."'";
		$results1 = mysql_query($sql);
		$sql = "SELECT * FROM partie WHERE joueur2 = '".$J1."'";
		$results2 = mysql_query($sql);
		$n1 = mysql_num_rows($results1);
		$n2 = mysql_num_rows($results2);
		$number = $n1 + $n2;
		echo "Nombre de réponses: "  .$number;
		
		if($number != 0)
		{
			echo '<div id="affiche_resultat">';
			echo '	<table border="1">
					<tr>
					<th class="center" width="60">Joueur 1</th>
					<th class="center" width="60">Joueur 2</th>
					<th class="center" width="120">Résultat</th>
					<th class="center" width="120">Score</th>
					<th class="center" width="100">Date</th>
					<th class="center" width="100">Heure</th>
					</tr>';
				
			while($data = mysql_fetch_assoc($results1)) 
		    {	
		     	$J1 = $data['joueur1'];
				$J2 = $data['joueur2'];
				$resultat_partie = $data['resultat_partie'];
				$score = $data['score_joueur1'];
				$date = $data['date_partie'];
				$heure = $data['heure_partie'];
				echo "<tr> 
					  <td align=center width='60'> $J1 </td> 
					  <td align=center width='60'> $J2 </td> 
					  <td align=center width='120'> $resultat_partie </td>
					  <td align=center width='120'> $score </td>
					  <td align=center width='100'> $date </td>
					  <td align=center width='100'> $heure </td>	
					  </tr>";
		    }						
			while($data = mysql_fetch_assoc($results2)) 
		    {	
				$J1 = $data['joueur1'];
				$J2 = $data['joueur2'];
				$resultat_partie = $data['resultat_partie'];
				$score = $data['score_joueur2'];
				$date = $data['date_partie'];
				$heure = $data['heure_partie'];
				echo "<tr> 
					  <td align=center width='60'> $J2 </td> 
					  <td align=center width='60'> $J1 </td>
					  <td align=center width='120'> $resultat_partie </td>
					  <td align=center width='120'> $score </td>
					  <td align=center width='100'> $date </td>
					  <td align=center width='100'> $heure </td>	
					  </tr>";	  
		    }		
			echo "</table>";
			echo '</div>';
		}
*/		
	
	
	
	
?> 