<?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);




$student_id = $request->getAttribute('student_id');
$student_name=$request->getParsedBody()['student_name'];
$roll_number=$request->getParsedBody()['roll_number'];
$email_id=$request->getParsedBody()['email_id'];

$query = "UPDATE  student SET student_name=?,roll_number=?,email_id=? WHERE student_id=$student_id";
 $stmt = $con->prepare($query);
 $stmt->bind_param("sss",$student_name,$roll_number,$email_id);
  //$stmt->execute();
 $result = $stmt->execute();
        $stmt->close();
        if($result==true){
            $data=
        array(
           "id"=>$student_id,
         );
    
    $message=$data;

$response=array('status' => "true",'Message' => "student Details Updated Succesfully",'Student' => $message);
echo json_encode($response);
        }
        else{
          $response=array('status' => "false",'Message' => "Student Details Update Failed");
         echo json_encode($response);
        }   

//  	$sql= "UPDATE student SET insitute_name='$insitute_name',institute_no='$institute_no',student_name='$student_name',roll_number='$roll_number',department='$department',course='$course',batch='$batch',email_id='$email_id',mobile_number='$mobile_number',password='$password',confirm_password='$confirm_password',status='$status' WHERE student_id=$student_id";

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

// 	$data=array('name' =>$student_name, 'id' =>$student_id);
 

	

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

// echo json_encode($response); 


?>