<?php
	include "../../include/config.php";
	$return_arr = array();
	$data = mysql_query("SELECT id, prod_code, prod_name, prod_sat, CONCAT_WS(' - ', prod_code, prod_name) codename 
	                     FROM product WHERE CONCAT_WS(' - ', prod_code, prod_name) LIKE '%" . mysql_real_escape_string($_GET['term']) . "%' AND prod_cat=4 
						 ORDER BY prod_code ASC");
	while($line = mysql_fetch_array($data, MYSQL_ASSOC)){
		$row_array["value"]        = $line["prod_code"]." => ".$line["prod_name"];
		$row_array["prod_id"] 	   = $line["id"];
		$row_array["prod_code"]    = $line["prod_code"];
		$row_array["prod_sat"]     = $line["prod_sat"];
		array_push($return_arr, $row_array);
	}
	echo json_encode($return_arr);
?>