<?php 
include('includes/config/config.php');
error_reporting(E_ERROR | E_PARSE);
$Id = $_REQUEST['id'];
$query = "select * from checkup_form where checkup_id = '".$Id."' ";
 
$child_query="select * from checkup_form_key_value where checkup_form_id='".$Id."' ";
$result1 = @mysqli_query($conn,$child_query);
  if (!$result = @mysqli_query($conn,$query )) {
            exit(mysqli_error($conn));
        }
	$data = array();
	$x=0;

	if(mysqli_num_rows($result) > 0) {
		
        while ($row = mysqli_fetch_assoc($result)) {
           // $data[$x] = $row;
			//$data[]=$row;
			//$x++;
			$data['parent']=$row;
        }
		
		while ($row_child = mysqli_fetch_assoc($result1)) {
           $data['child'][$x] =$row_child ;
			
			$x++;
        }
    }
	 else
    {
        $data['status'] = 200;
        $data['message'] = "Data not found!";
    }
	
 echo json_encode($data);
?>