<?php
/* Attempt to connect to MySQL database */
$con = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

 
    //Verifying the required parameters
    // verifyRequiredParams(array('firstname', 'email', 'password'));
$id=$request->getAttribute('schedule_id');
$paper=$request->getParsedBody()['paper'];
$slots=$request->getParsedBody()['slots'];
$date=$request->getParsedBody()['date'];
$time=$request->getParsedBody()['time'];
$duration=$request->getParsedBody()['duration'];

 $data=array();

  $query ="UPDATE schedule_exam SET paper=?,slots=?,dates=?,timess=?,duration=? WHERE id='$id'";
  $stmt = $con->prepare($query);
 $stmt->bind_param("sssss",$paper,$slots,$date,$time,$duration);
  //$stmt->execute();
 $result = $stmt->execute();
        $stmt->close();
        if($result==true){
            $data=
        array(
            'paper' => $paper,
            'slots' =>$slots,
            'date' => $date,
            'time'=>$time,
            'duration' =>$duration,
         );
    
    $message=$data;

$response=array('status' => "true",'Message' => "Examschedule updated Succesfully",'Faculty' => $message);
echo json_encode($response);
        }
        else{
          $response=array('status' => "false",'Message' => "Update Examschedule Failed");
         echo json_encode($response);
        }   
?>