File "changement.php"

Full Path: /home/analogde/www/DOSSIER/SFR/Massage_10_12_2016/changement.php
File size: 1.71 KB
MIME-type: text/x-php
Charset: utf-8

<?php

		$annee = date('Y');	
		$table = "reservation" .$annee;
		$mois = "avril";
		$jour = "21-04-2015";
		
		include('database.php');
		DB_connexion(); 
	
		$sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and mois ='$mois' and rendezvous ='$jour' ";	
		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());
		}
		
		$data = mysqli_fetch_assoc($result);
		
		$horairedebut = $data['horairedebut'];
		$horairefin = $data['horairefin'];
		$avant = $data['avant'];
		$apres = $data['apres'];
		
		$indice_debut = substr($horairedebut, 5);					
		$indice_fin = substr($horairefin, 4);
		
		echo $indice_debut ." ".$indice_fin ." " .$avant ." " .$apres;
		
		$tab_seance = array();		
		$tab_seance[] = "decalage";

		for( $i=1; $i <9 ; $i++)	
		{	
			$tab_seance[] = "inactif";							
		}	
		
		echo '<pre>';
		print_r($tab_seance);	
		
		for( $i = $indice_debut; $i <= $indice_fin ; $i++)				
		{ 
				$tab_seance[$i] = "normale";
		}
		
		echo '<pre>';
		print_r($tab_seance);	

		$supplement_avant_debut = $indice_debut - $avant;	
		$supplement_avant_fin = $indice_debut - 1;				
		$supplement_apres_debut = $indice_fin + 1;	
		$supplement_apres_fin = $indice_fin + $apres;

		for( $i=1; $i <9 ; $i++)
		{	/*		
			if( $i >= $indice_debut && $i <= $indice_fin)
			{	
				$tab_seance[$i] = "normale";	
			}*/				
			if( $i >= $supplement_apres_debut && $i <= $supplement_apres_fin)		
			{	
				$tab_seance[$i] = "etendu";	
			}	
			if( $i >= $supplement_avant_debut && $i <= $supplement_avant_fin)	
			{	
				$tab_seance[$i] = "etendu";	
			}				
		}
		
		echo '<pre>';
		print_r($tab_seance);	
		
?>