<?php

/*Student API*/


/*Fetching API*/


/* 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->getParsedBody()['course_id'];
$season_id=$request->getParsedBody()['season_id'];
$examname=$request->getParsedBody()['examname'];
$exam_start_date_time=date('Y-m-d H:i:s');

// $start_module='2';

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

$response=array();

 

// }


	$sql="UPDATE Exams SET exam_start='1',exam_start_date_time ='$exam_start_date_time' WHERE course_id = '$course_id'AND season_id = '$season_id'AND examname = '$examname'";


$res= $con->query($sql);

  $data=array('name' =>$season_id, 'id' =>$examname);
 

  

  $response=array('status' => "true",'Message' => "Data updated successfully",'Exams' => $data);

echo json_encode($response); 


?>