<?php



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

$course_id = $request->getAttribute('course_id');


if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$response=array();


if(isset($course_id)){
 $sql="SELECT schedule_exam.id,schedule_exam.course_id,schedule_exam.exams_id,schedule_exam.season_id,
 schedule_exam.paper_id,schedule_exam.slots,schedule_exam.date,schedule_exam.time,schedule_exam.duration,course.course_name,
 Exams.examname,season.seasonname,set_papers.papers_shortcode,set_papers.paper_name 
 FROM schedule_exam INNER JOIN course ON course.course_id = schedule_exam.course_id INNER JOIN Exams
ON Exams.id = schedule_exam.exams_id INNER JOIN season ON season.id=schedule_exam.season_id
 INNER JOIN set_papers ON set_papers.papers_id=schedule_exam.paper_id WHERE schedule_exam.course_id = '$course_id'";
}


$result=mysqli_query($con,$sql);

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

      $user=$row;


    }


echo json_encode($user);





?>