<?php
$con = mysqli_connect(localhost, restax, restax@123, Restax);     


$chapter_id=$request->getParsedBody()['chapter_id'];
$main_topics=$request->getParsedBody()['main_topics'];




		
$response=array();

$sql12="SELECT * FROM subject_main_topics WHERE chapter_id='$chapter_id' AND main_topics='$main_topics'";

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

if(mysqli_num_rows($res12) > 0)
{

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

echo json_encode($response2);

  
}
else{
$sql="INSERT INTO subject_main_topics(chapter_id,main_topics) VALUES ('$chapter_id','$main_topics')";


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



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


	    // $message=$data;

		

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

echo json_encode($response);

}

 
?>