<?php 
include('includes/config/config.php');
error_reporting(E_ERROR | E_PARSE);
$Id = $_REQUEST['guest_id'];
$query = "select checkup_form_value,checkup_date from guest_checkup_form inner join guest_checkup_form_key_value on guest_checkup_form_key_value.checkup_form_id=guest_checkup_form.checkup_id where guest_id ='$Id' and checkup_form_key='weight' order by checkup_date asc limit 6";
//echo $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[$x]['checkup_form_value']=$row['checkup_form_value'];
			$data[$x]['checkup_date']=date_format(date_create($row['checkup_date']),"d-M-Y");
			
			
			
			$x++;
        }
		
    }
	 else
    {
        $data['status'] = 200;
        $data['message'] = "Data not found!";
    }
	
 echo json_encode($data);
?>