File "multi.php"

Full Path: /home/analogde/www/Massage_online2018/multi.php
File size: 6.8 KB
MIME-type: text/x-php
Charset: utf-8

<?php

	session_start ();
	include('database.php');	
	DB_connexion(); 
	
	header( 'content-type: text/html; charset=utf-8' );


/*
	$cars = array
  (
  array("Volvo",22,18),
  array("BMW",15,13),
  array("Saab",5,2),
  array("Land Rover",17,15)
  );
  
  $marks = array( 
            "mohammad" => array (
               "physics" => 35,
               "maths" => 30,	
               "chemistry" => 39
            ),
            
            "qadir" => array (
               "physics" => 30,
               "maths" => 32,
               "chemistry" => 29
            ),
            
            "zara" => array (
               "physics" => 31,
               "maths" => 22,
               "chemistry" => 39
            )
         );
         
       
         echo "Marks for mohammad in physics : " ;
         echo $marks['mohammad']['physics'] . "<br />"; 
         
         echo "Marks for qadir in maths : ";
         echo $marks['qadir']['maths'] . "<br />"; 
         
         echo "Marks for zara in chemistry : " ;
         echo $marks['zara']['chemistry'] . "<br />"; 
*/		 
		 
		 $annee = date('Y');
		 $table = "reservation" .$annee;
		 $mois = "octobre";
		 
		 $sql = "SELECT * FROM " .$table  ." WHERE mois ='$mois' and formule = 'courte' and mode ='actif' ";

		 mysqli_query($connexion, "SET NAMES 'utf8'");
		 $result = mysqli_query($connexion, $sql );
		 
		 if(!$result)	
		 {	die('Impossible d\'exécuter la requête :' . mysql_error());	
		 }

		 $tab_client_courte = array();
	
		 while ($datas = mysqli_fetch_assoc ($result))
		 {
			$seance1 = $datas['seance1'];
			$seance2 = $datas['seance2'];
			$seance3 = $datas['seance3'];
			$seance4 = $datas['seance4'];
			$seance5 = $datas['seance5'];
			$seance6 = $datas['seance6'];
			$seance7 = $datas['seance7'];
			$seance8 = $datas['seance8'];
		
			if(strlen($seance1) !=0 && $seance1 != "unselect" && $seance1 != "creneau ouvert" && $seance1 != "creneau fermer")
			{ $tab_client_courte[] = $seance1;
			}
			if(strlen($seance2) !=0 && $seance2 != "unselect" && $seance2 != "creneau ouvert" && $seance2 != "creneau fermer")
			{ $tab_client_courte[] = $seance2;
			}
			if(strlen($seance3) !=0 && $seance3 != "unselect" && $seance3 != "creneau ouvert" && $seance3 != "creneau fermer")
			{ $tab_client_courte[] = $seance3;
			}
			if(strlen($seance4) !=0 && $seance4 != "unselect" && $seance4 != "creneau ouvert" && $seance4 != "creneau fermer")
			{ $tab_client_courte[] = $seance4;
			}
			if(strlen($seance5) !=0 && $seance5 != "unselect" && $seance5 != "creneau ouvert" && $seance5 != "creneau fermer")
			{ $tab_client_courte[] = $seance5;
			}
			if(strlen($seance6) !=0 && $seance6 != "unselect" && $seance6 != "creneau ouvert" && $seance6 != "creneau fermer")
			{ $tab_client_courte[] = $seance6;
			}
			if(strlen($seance7) !=0 && $seance7 != "unselect" && $seance7 != "creneau ouvert" && $seance7 != "creneau fermer")
			{ $tab_client_courte[] = $seance7;
			}
			if(strlen($seance8) !=0 && $seance8 != "unselect" && $seance8 != "creneau ouvert" && $seance8 != "creneau fermer")
			{ $tab_client_courte[] = $seance8;
			}
		
			echo '<pre>';
			print_r($datas);
		}

		echo "++++++++++++++++++++++++++++++++++++++";
		echo '<pre>';
		print_r($tab_client_courte);
		 
		print_r(array_count_values($tab_client_courte));
			
		/******************************************************/
			
		$sql = "SELECT * FROM " .$table  ." WHERE mois ='$mois' and formule = 'longue' and mode ='actif' ";

		mysqli_query($connexion, "SET NAMES 'utf8'");
		$result = mysqli_query($connexion, $sql );
		 
		if(!$result)	
		{	die('Impossible d\'exécuter la requête :' . mysql_error());	
		}

		$tab_client_longue = array();
	
		while ($datas = mysqli_fetch_assoc ($result))
		{
			$seance1 = $datas['seance1'];
			$seance2 = $datas['seance2'];
			$seance3 = $datas['seance3'];
			$seance4 = $datas['seance4'];
			$seance5 = $datas['seance5'];
			$seance6 = $datas['seance6'];
			$seance7 = $datas['seance7'];
			$seance8 = $datas['seance8'];
		
			if(strlen($seance1) !=0 && $seance1 != "unselect" && $seance1 != "creneau ouvert" && $seance1 != "creneau fermer")
			{ $tab_client_longue[] = $seance1;
			}
			if(strlen($seance2) !=0 && $seance2 != "unselect" && $seance2 != "creneau ouvert" && $seance2 != "creneau fermer")
			{ $tab_client_longue[] = $seance2;
			}
			if(strlen($seance3) !=0 && $seance3 != "unselect" && $seance3 != "creneau ouvert" && $seance3 != "creneau fermer")
			{ $tab_client_longue[] = $seance3;
			}
			if(strlen($seance4) !=0 && $seance4 != "unselect" && $seance4 != "creneau ouvert" && $seance4 != "creneau fermer")
			{ $tab_client_longue[] = $seance4;
			}
			if(strlen($seance5) !=0 && $seance5 != "unselect" && $seance5 != "creneau ouvert" && $seance5 != "creneau fermer")
			{ $tab_client_longue[] = $seance5;
			}
			if(strlen($seance6) !=0 && $seance6 != "unselect" && $seance6 != "creneau ouvert" && $seance6 != "creneau fermer")
			{ $tab_client_longue[] = $seance6;
			}
			if(strlen($seance7) !=0 && $seance7 != "unselect" && $seance7 != "creneau ouvert" && $seance7 != "creneau fermer")
			{ $tab_client_longue[] = $seance7;
			}
			if(strlen($seance8) !=0 && $seance8 != "unselect" && $seance8 != "creneau ouvert" && $seance8 != "creneau fermer")
			{ $tab_client_longue[] = $seance8;
			}
		
			echo '<pre>';
			print_r($datas);
		}

			echo "++++++++++++++++++++++++++++++++++++++";
			echo '<pre>';
			print_r($tab_client_longue);
		
		 
			print_r(array_count_values($tab_client_longue));
			
		 
			//array_count_values(array_map(function($o) {return $o->type;}, $array))['photo'];
		 
		    //$sql = "SELECT * FROM db.table WHERE 'phone1' = '".$phone."' OR 'phone2' = '".$phone."' OR 'phone3' = '".$phone."' OR 'phone4' = '".$phone."'


?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Espace réservation</title>

<link rel="stylesheet" href="menu_style.css" type="text/css">

	<div id='cssmenu'>
	<ul>
		<li><a href='home.php'><span>Home</span></a></li>
		<li><a href='selection_planning_mois.php'><span>Planning</span></a></li>
		<li><a href='selection_gestion_mois.php'><span>Gestion</span></a></li>
		<li class='active'><a href='selection_statistique_mois.php'><span>Statistiques</span></a></li>
<?php
		if($_SESSION['nom'] == "admin")
		{ 	
			echo '<li><a href="deplacer_un_rendezvous_admin.php"><span>Déplacer</span></a></li>';
			echo '<li><a href="configuration.php"><span>Configuration</span></a></li>';
		}
		else
		{
			echo '<li><a href="deplacer_un_rendezvous_user.php"><span>Déplacer</span></a></li>';
		}
?>
		<li><a href='change_password.php'><span>Changer password</span></a></li>
		<li><a href='logout.php'><span>Déconnexion</span></a></li>
		<li><a href='#'><span><?php echo $_SESSION['nom'] .' ' .$_SESSION['prenom'] .' connecté' ?></span></a></li>
	</ul>
	</div>
	
	<br>
<?php	//echo  ucfirst($mois_actif); ?>
	<br>
	<br>
	
</head>