<?php

$con = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
/*
$blockid = $request->getAttribute('blockid');
$floors=$request->getAttribute('floors');
$exams_id=$request->getAttribute('exams_id');
$paper=$request->getAttribute('paper');
$slots=$request->getAttribute('slots');
*/
$set_blocks_block_id=$request->getAttribute('set_blocks_block_id');
//$floors=$request->getAttribute('floors');
$response=array();
/*
if(isset($blockid)&&isset($floors)){
$sql="SELECT seatingarrangements.blockid, seatingarrangements.floors, seatingarrangements.room_id,
seatingarrangements.seats, seatingarrangements.proctors, set_blocks.block_name
from (seatingarrangements INNER JOIN set_blocks ON set_blocks.block_id=seatingarrangements.blockid)
WHERE seatingarrangements.blockid=$blockid AND seatingarrangements.floors=$floors";
}
elseif(isset($blockid)){
$sql="SELECT seatingarrangements.blockid, seatingarrangements.floors, seatingarrangements.room_id,
seatingarrangements.seats, seatingarrangements.proctors, set_blocks.block_name
from (seatingarrangements INNER JOIN set_blocks ON set_blocks.block_id=seatingarrangements.blockid)
WHERE seatingarrangements.blockid=$blockid";
}

else{
$sql="SELECT seatingarrangements.blockid, seatingarrangements.floors, seatingarrangements.room_id,
seatingarrangements.seats, seatingarrangements.proctors, set_blocks.block_name
from (seatingarrangements INNER JOIN set_blocks ON set_blocks.block_id=seatingarrangements.blockid)";
}
*//*
if(isset($block_shortcode)&&isset($floors)){
$sql="SELECT set_seats.set_blocks_block_id, set_seats.floors, set_seats.set_rooms_room_id, set_seats.seats, set_seats.proctors,
set_blocks.block_name, set_rooms.room_name 
from (set_seats INNER JOIN set_blocks ON set_blocks.block_id=set_seats.set_blocks_block_id
INNER JOIN set_rooms ON set_rooms.room_id=set_seats.set_rooms_room_id)
WHERE set_seats.block_shortcode='$block_shortcode' AND
set_seats.floors='$floors'
";
}
else
*/	
if(isset($set_blocks_block_id)){
$sql="SELECT set_seats.set_blocks_block_id, set_seats.floors, set_seats.set_rooms_room_id, set_seats.seats, set_seats.proctors,
set_blocks.block_name, set_rooms.room_name 
from (set_seats INNER JOIN set_blocks ON set_blocks.block_id=set_seats.set_blocks_block_id
INNER JOIN set_rooms ON set_rooms.room_id=set_seats.set_rooms_room_id)
WHERE set_seats.set_blocks_block_id='$set_blocks_block_id'
";
}


else{
$sql="SELECT set_seats.set_blocks_block_id, set_seats.floors, set_seats.set_rooms_room_id, set_seats.seats, set_seats.proctors,
set_blocks.block_name, set_rooms.room_name 
from (set_seats INNER JOIN set_blocks ON set_blocks.block_id=set_seats.set_blocks_block_id
INNER JOIN set_rooms ON set_rooms.room_id=set_seats.set_rooms_room_id)
";
}
$result=mysqli_query($con,$sql);

    while ($row[]=mysqli_fetch_assoc($result)) {  

      $user=$row;

	}


echo json_encode($user);


?>