<?php

define('DB_SERVER', 'localhost');

define('DB_USERNAME', 'Restax_final');

define('DB_PASSWORD', 'Restax_final123');

define('DB_NAME', 'Restax_api_data'); 

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




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


 	$sql= "UPDATE chapter SET chapters='$chapters' WHERE chapter_id=$chapter_id";

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

	$data=array('chapters' =>$chapters, 'id' =>$chapter_id);
 

	

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

echo json_encode($response); 


?>