<?php
include "../../include/config.php";
include "../../function/inc_function.php";
$return_arr = array();

$data = mysql_query("SELECT id, prod_code, prod_name, prod_sat, CONCAT_WS(' - ', prod_code, prod_name, prod_spec, prod_type, prod_color) codename
	                     FROM product WHERE CONCAT_WS(' - ', prod_code, prod_name) LIKE '%" . mysql_real_escape_string($_GET['term']) . "%' AND prod_cat = 3 AND prod_cat<>100
						 ORDER BY prod_code ASC");
while ($line = mysql_fetch_array($data, MYSQL_ASSOC)) {
    $row_array["value"]        = htmlspecialchars($line["prod_code"]) . " => " . htmlspecialchars($line["prod_name"]);
    $row_array["prod_id"]        = $line["id"];
    $row_array["prod_name"]    = htmlspecialchars($line["prod_name"]);
    $row_array["prod_sat"]     = $line["prod_sat"];
    array_push($return_arr, $row_array);
}
echo json_encode($return_arr);
