<?php


define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'Restax_final');

define('DB_PASSWORD', 'Restax_final123');

define('DB_NAME', 'Restax_api_data'); 

$con = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

$date = $request->getAttribute('date');
$time = $request->getAttribute('time');



if(mysqli_connect_errno())
{
	echo "Failed to connect mysqli".mysqli_connect_errno();
}


/////get room number block id number/////

$sql_seat="SELECT * FROM faculty WHERE PWI = '1' AND date <> '$date' AND time <> '$time'";

$result_seat=mysqli_query($con,$sql_seat);
$i=0;
    while ($row_seat=mysqli_fetch_assoc($result_seat)) {  

 $id[$i]=$row_seat['id'];
 $faculty_name[$i]=$row_seat['Faculty_name'];
 $Staff_number[$i]=$row_seat['Staff_number'];



$rollnumber_data[$i][] = $id[$i];
$rollnumber_data[$i][] = $faculty_name[$i];
$rollnumber_data[$i][] = $Staff_number[$i];
$rollnumber_data[$i][] = 'true';

 $keys = array('rollnumber','faculty_name','Staff_number','checked');

$final_data[] = array_combine($keys,$rollnumber_data[$i]);

 $i++;

}


// for($i=0;$i<count($user_seat);$i++){
// $user_seat[$i] = json_decode($user_seat[$i]);

// }



echo json_encode($final_data);
  
?>