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


$main_topics_id=$request->getParsedBody()['main_topics_id'];
$sub_topics_heading=$request->getParsedBody()['sub_topics_heading'];




		
$response=array();

$sql12="SELECT * FROM sub_topics WHERE main_topics_id='$main_topics_id' AND sub_topics_heading='$sub_topics_heading'";

$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 sub_topics(main_topics_id,sub_topics_heading) VALUES ('$main_topics_id','$sub_topics_heading')";


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



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


	    // $message=$data;

		

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

echo json_encode($response);

}

 
?>