<?php
$DB_DATABASE = "";
$prefix = "iitech_";
if(isset($_POST['database'])){
	$DB_DATABASE = $prefix.$_POST['database'];
}

// include db connect class
require_once __DIR__ . '/include/new_db_connect.php';

// connecting to db
$db = connect($DB_DATABASE);

$json1  = array();
$json  = array();

$affiche = 'YES';
$query = "SELECT annee_acad, periode from academique where affiche = :affiche order by annee_acad ASC";
$statement = $db->prepare($query);
$statement->bindParam(':affiche', $affiche, PDO::PARAM_STR);
$statement->execute();
while($row=$statement->fetch(PDO::FETCH_ASSOC)){
	$json1['academique'][]=$row;		
}

$json['acad'][]   = $json1;
echo json_encode($json); 	
?>
