<?php 

//session_start();
include("db_config.php"); 
if($_SERVER['REQUEST_METHOD']=='POST'){
	
	$user_id = $_POST['user_id'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email = $_POST['email'];
    if(!empty($email)){
    	$emailid=$_POST['email'];
    }else{
    	$emailid="";
    }
	$sql = "UPDATE user_profile SET  fname =  '$first_name', lname = '$last_name', email = '$email' WHERE id ='$user_id'";
	$result = mysqli_query($conn, $sql);

	if($result){
            $json = array("status" => 1, "msg" => "User Details Update Successfully!");
	}else{
		//displaying failure if otp given is not equal to the otp fetched from database  
		$json = array("status" => 0, "msg" => "Failed!");
	}
	
	echo json_encode($json);
	mysqli_close($conn);
}