<?php
	session_start();
	include("../../php_crud/my_class.php");
	$obj=new my_class();
	extract($_GET);
	
	$keyword = strval($_POST['query']);
    $keyword = ucwords($keyword);
    $cond = "RIVER_CODE='$river_code' AND STATION_ID LIKE '$keyword%'";

	$tbl_name = "SW_STATION_TBL";
	$cols = "STATION_ID,STATION_NAME";
	
	foreach($obj->View_colmn_By_Cond_hydro($tbl_name,$cols,$cond) AS $station_list){
		$station_name = $station_list['STATION_ID'].'('.$station_list['STATION_NAME'].')';
		$station_id = $station_list['STATION_ID'];
		$station_res[] = array('station_name'=>$station_name, 'station_id'=>$station_id);
	}
	echo json_encode($station_res);
?>