<?php
$con = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
     
	    $course_id=$request->getParsedBody()['course_id'];
		$season_id=$request->getParsedBody()['season_id'];
		$exams_id=$request->getParsedBody()['exams_id'];
		$submit_answer_script_id=$request->getParsedBody()['submit_answer_script_id'];
		$set_sections_id=$request->getParsedBody()['set_sections_id'];
		$set_Q_papers_id=$request->getParsedBody()['set_Q_papers_id'];
	    $question_pattern_id=$request->getParsedBody()['question_pattern_id'];
		$submit_student_answer_id=$request->getParsedBody()['submit_student_answer_id'];
		$question=$request->getParsedBody()['question'];
		$answer=$request->getParsedBody()['answer'];
		$score=$request->getParsedBody()['score'];
		$state=$request->getParsedBody()['state'];
			
$response=array();
/*
$sqll="(SELECT * FROM set_student_season WHERE  rollnumber='$rollnumber' OR status='$status')";
$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 evaluate_answer_scripts(course_id,season_id,exams_id,submit_answer_script_id,
set_sections_id,set_Q_papers_id,question_pattern_id,
submit_student_answer_id,question,answer,
score,state)
 VALUES ('$course_id','$season_id','$question_pattern_id','$submit_answer_script_id','$set_sections_id','$set_Q_papers_id',
 '$question_pattern_id',
 '$submit_student_answer_id','$question','$answer','$score','$state')";

$res= $con->query($sql);
	
if($res==true)
{
		$data=array(
	"course_id"=>$course_id,
	"season_id"=>$season_id,
	"exams_id"=>$exams_id,
	"submit_answer_script_id"=>$submit_answer_script_id,
	"set_sections_id"=>$set_sections_id,
	"set_Q_papers_id"=>$set_Q_papers_id,
	"question_pattern_id"=>$question_pattern_id,
	
	"submit_student_answer_id"=>$submit_student_answer_id,
	"question"=>$question,
	"answer"=>$answer,
	"score"=>$score,
	"state"=>$state,
	
	);
	    $message=$data;

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



?>