<?php

$con = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

  $set_sections_id=$request->getParsedBody()['set_sections_id'];
		$Q_questions=$request->getParsedBody()['Q_questions'];  
  $marks_alloted=$request->getParsedBody()['marks_alloted'];
		$subsets	=$request->getParsedBody()['subsets'];       
 $marks_for_subsets	=$request->getParsedBody()['marks_for_subsets'];
		$ideal_time	=$request->getParsedBody()['ideal_time'];       		
			    	
                        
$response=array();

/*
$sqll="(SELECT * FROM set_rooms WHERE  room_name='$room_name' )";
$res= $con->query($sqll);
if($res->num_rows>0)
{
$response1=array('status' => "true",'Message' => "data already exist");
echo json_encode($response1);
}

else{*/
$sql="INSERT INTO set_Q_papers(set_sections_id,Q_questions,marks_alloted,subsets,marks_for_subsets,ideal_time) VALUES ('$set_sections_id','$Q_questions','$marks_alloted','$subsets','$marks_for_subsets','$ideal_time')";

$res= $con->query($sql);
	
if($res==true)
{
		$data=array(
	"set_sections_id"=>$set_sections_id,
	"Q_questions"=>$Q_questions,
	"marks_alloted"=>$marks_alloted,
	"subsets"=>$subsets,
	"marks_for_subsets"=>$marks_for_subsets,
	"ideal_time"=>$ideal_time,
	);
	    $message=$data;
	

	
	$response=array('status' => "true",'Message' => "Data inserted successfully",'set_Q_papers' => $message);
echo json_encode($response);
        
}
        else{
          $response=array('status' => "false",'Message' => " insert data failed");
         echo json_encode($response);
        }   
		


?>