<?php
	
	include('database.php');
	include('fonctions.php');
	DB_connexion(); 
	
	$annee = date('Y');
	$table = "reservation" .$annee;
	
	
	
	
		$client = "APCHER Alexandre";
	
		$sql = "SELECT * FROM gestion WHERE annee ='$annee' AND client = '$client' and mode = 'actif' ";
		echo $sql;
		mysqli_query($connexion, "SET NAMES 'utf8'");	
		$result = mysqli_query($connexion, $sql );
	
		if(!$result)
		{	
			die('Impossible d\'exécuter la requête :' . mysql_error());
		}
	
		$n = mysqli_num_rows($result);
		echo " ---> " .$n;
	
		$tab_jour = array();
		$tab_seance = array();	
		
		$ts_du_jour = strtotime(date("d-m-Y"));	
	
		while ($data = mysqli_fetch_assoc ($result))
		{
			$ts = strtotime($data['jour']);
		
			if($ts_du_jour < $ts)
			{
				$tab_jour[] = $data['jour'];
				$tab_seance[] = decoder_horaire($data['seance']);
			}	
		}
		
		/*for( $i=0; $i < count($tab_jour) ; $i++)
		{
		
			$infos = $tab_jour[$i] ." * " .$tab_seance[$i];
			echo '<option value="' .$infos. '">' .$infos. '</option>'; 
		
		}*/	
		
		print_r($tab_seance);
	
	
?>