<?php

/* Attempt to connect to MySQL database */
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');
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$response=array();

$list_present = array();
//////////////get submit answer/////////////////

if(isset($course_id)&&isset($season_id)&&isset($exams_id))
{
$sql_get_submit="SELECT DISTINCT date FROM seated_students WHERE course_id ='$course_id' AND season_id ='$season_id' AND exams_id ='$exams_id' ";
}
elseif(isset($course_id)&&isset($season_id)){
  $sql_get_submit="SELECT DISTINCT date FROM seated_students WHERE course_id ='$course_id' AND season_id ='$season_id'";
}
elseif(isset($course_id)){
  $sql_get_submit="SELECT DISTINCT date FROM seated_students WHERE course_id ='$course_id'";
}
else{
   $sql_get_submit="SELECT DISTINCT date FROM seated_students";
}
$result_get_submit=mysqli_query($con,$sql_get_submit);

    while ($row_get_submit=mysqli_fetch_assoc($result_get_submit)) {  



   


      $user_get_submit[]=$row_get_submit;


    }

  echo json_encode($user_get_submit);

   

?>