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


$unit_id=$request->getParsedBody()['unit_id'];
$chapters=$request->getParsedBody()['chapters'];




		
$response=array();

$sql12="SELECT * FROM chapter WHERE unit_id='$unit_id' AND chapters='$chapters'";

$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 chapter(unit_id,chapters) VALUES ('$unit_id','$chapters')";


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



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


	    // $message=$data;

		

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

echo json_encode($response);

}

 
?>