<?php
	include("../../php_crud/my_class.php");
	$obj = new my_class();
	extract($_REQUEST);
	
	$station_id = $_REQUEST['well_id'];
	//echo $station_id;
       
	
	$max_data = date('m-Y');
    //echo $max_data;
    
    $row  = $obj->sw_wl_auto_data_list($station_id,$max_data);
	
	$data = array(
		'date' => array(),
		'data' => array(),
		
	    );
	foreach($row AS $index=>$val)
	{
		// $date = date('j M, Y', strtotime($val['DATETIME']));
                $date = $val['DATETIME'];
		$value = number_format($val['VALUE'],3);
		//echo $date;
	//	echo $value;
		// $res[] = array("period"=>"$date", "value"=>$value);	
		$data['date'][]= $date;
		$data['data'][]=$value;
	}
	// if(count($res)>0){
	// 	echo $datas = json_encode($res);
	// }
	// else{
	// 	$res[] = array("period"=>'', "value"=>'');
	// 	echo $datas = json_encode($res);
	// }
	echo json_encode($data);
?>
