Featch data in php using rest api
$row['id'],"name"=>$row['name'],"age"=>$row['age']); } return $data; } function response($data) { //json formet echo json_encode($data); } ?>// All crud operations in php using restapi featch data , insert data , update data
$row['id'],"name"=>$row['name'],"age"=>$row['age']); } return $data; } function adddata(){ global $conn=mysqli_query($conn,"insert into rest(name,age)values(" ".$POST['name'].",".$POST['age'])"); if($query==true) { $data[]=array("message"=>"success"); } else { $data[]=array("message"=>"failed"); } return $data; } function updatedata(){ global $conn; parse_str(file_get_content('php://input'),$_PUT); if($GET['id']){ $id=$_GET['id']; $where="where id=".$id; } else { $id=0; $where=""; } $query=mysqli_query($conn,"update rest set name'".$_PUT['name'].'" age'".$_PUT['age']."'.$where); if($query==true) { $data[]=array("message"=>"update"); } else { $data[]=array("message"=>"failed"); } return $data; } function response($data) { //json formet echo json_encode($data); } ?>