<?php
$con = mysqli_connect(localhost, Restax_final, Restax_final123, Restax_api_data);     

$course_id=$request->getParsedBody()['course_id'];
$season_id=$request->getParsedBody()['season_id'];
$examname=$request->getParsedBody()['examname'];
$examtype=$request->getParsedBody()['examtype'];


		
$response=array();

$sql12="SELECT * FROM Exams WHERE course_id='$course_id' AND season_id='$season_id' AND examname='$examname'AND examtype='$examtype'";

$res12= $con->query($sql12);

if(mysqli_num_rows($res12) > 0)
{

$response=array('status' => "true",'Message' => "Data Already Exits");

echo json_encode($response);

}
else{ 

$sql="INSERT INTO Exams(course_id,season_id,examname,examtype) VALUES ('$course_id','$season_id','$examname','$examtype')";


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

	$data=array('name' =>$examtype, );


	    // $message=$data;

		

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

echo json_encode($response);

}


?>