
<?php 
error_reporting(0);

include('db_connect.php');
$response = array(); 
if(isset($_POST["item_id"])){
	$item_id = $_POST['item_id'];
    $dated = $_POST['dated'];
        $item_desc = $_POST['item_desc'];
        $item_name = $_POST['item_name'];
 $query="UPDATE `grocery_list` SET `item_name`='$item_name',`item_desc`='$item_desc',
 `dated`='$dated' WHERE `item_id`='$item_id'";
  if(mysqli_query($conn,$query)){
   $response['error'] = false; 
			$response['message'] = "Updated successfully";

  }else{
   	$response['error'] = true; 
			$response['message'] = "Some error occurred please try again";	
  }
}else{
	echo "error";
}

echo json_encode($response);
mysqli_close($conn);
?>