<?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);


// $course_id = $request->getAttribute('course_id');
// $season_id = $request->getAttribute('season_id');
// $exams_id = $request->getAttribute('exams_id');
$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 seated_students.*,Exams.examname,set_blocks.block_shortcode,set_rooms.room_name FROM seated_students INNER JOIN Exams ON Exams.id = seated_students.exams_id INNER JOIN set_blocks ON set_blocks.block_id = seated_students.blockid INNER JOIN set_rooms ON set_rooms.room_id = seated_students.room_id WHERE seated_students.date = '$date' AND seated_students.time = '$time'";

$result_seat=mysqli_query($con,$sql_seat);

$i = 0;

    while ($row_seat[]=mysqli_fetch_assoc($result_seat)) {  


$user_seat = $row_seat;


$i++;

}

//print_r($user_seat);

for($k=0;$k<count($user_seat);$k++)
{
    $user_seat[$k]['papers_shortcode']=json_decode($user_seat[$k]['papers_shortcode']);
      $user_seat[$k]['proctors_list']=json_decode($user_seat[$k]['proctors_list']);

}
  echo json_encode($user_seat);
?>