<?php

// Attempt to connect to MySQL database /
// 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 = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);


$course_id=$request->getParsedBody()['course_id'];
 $roll_number = $request->getParsedBody()['roll_number'];
 $season_id = $request->getParsedBody()['season_id'];
  $exams_id = $request->getParsedBody()['exams_id'];
  $paper = $request->getParsedBody()['paper'];
  $slots=$request->getParsedBody()['slots'];
  $date = $request->getParsedBody()['date'];
  $student_name = $request->getParsedBody()['student_name'];
    
    $result_roll = json_encode($roll_number);

 $response=array();
 $data=array();

for($i=0;$i<count($roll_number);$i++)

{
    $new_insert_roll = $roll_number[$i][rollnumber];
    $new_insert_studentname = $roll_number[$i][student_name];


 $sql="INSERT INTO set_student_exampre (course_id,season_id,exams_id,paper,slots,roll_number,student_name,date) VALUES ('$course_id','$season_id','$exams_id','$paper','$slots','$new_insert_roll','$new_insert_studentname','$date')";
$res=mysqli_query($con,$sql);
if ($res=true) {
     // $data=
     //    array(
     //      "Exam_id"=>$exams_id,
     //     );
    
    $message=$data;
 
$response=array('status' => "true",'Message' => "schedule_exam Succesfully");
echo json_encode($response);
        }
        else{
          $response=array('status' => "false",'Message' => "schedule_exam Failed");
         echo json_encode($response);
        }
        
}
        
     // echo $roll_number[1][rollnumber];
      //  print_r($roll_number[0][rollnumber]);
?>