<?php
require_once('db.php');

$conn = mysqli_connect($servername, $username, $password, $dbname);
$res = new stdClass();
   $userId= trim($_POST["id"]);
   $userName= trim($_POST["name"]);
   $userphone= trim($_POST["phone"]);
   $userPassword = trim($_POST["email"]);

$sql = "UPDATE `user` SET name = '$userName',phone= '$userphone',email='$userPassword' WHERE id='$userId' ";
    
    $run = mysqli_query($conn,$sql);
    if($run==true){
    	    $row = mysqli_fetch_assoc($run);
    		 $res->success = 'success';
    	    echo json_encode($res);
    }
    else{
        echo "Failed";
    }
?>