<?php
mysql_connect("localhost", "root", "dick2head") or die (mysql_error());
mysql_select_db("power") or die (mysql_error());
$country =$_GET["country"];
$term =$_GET["term"];
$page = 15;
ถ้ารองระบุเป็น ID เลยได้ครับ ในก้อนฐานข้อมุล 6 mb
//$sql =" SELECT * from iim as d1 inner join tbfunction as d2 on (d1.iprod=d2.iprod) where d1.iprod='FGBE1031'";
แต่มาเป็นแบบรับค่าเองไม่ได้ครับ
$sql =" SELECT * from iim as d1 inner join tbfunction as d2 on (d1.iprod=d2.iprod) where d1.iprod LIKE '%$term%' limit $page ";
$qr = mysql_query($sql) or die (mysql_error());
$rows = mysql_num_rows($qr);
if($rows<=0){
$json_data[] = array("id"=>"0");
}else{
while($fetch = mysql_fetch_array($qr)){
//$json_data[] = array("id"=>$fetch["Id_std"], "label"=>$fetch["Name"], "value"=>$fetch["Name"], "address"=>$fetch["Address"], "country"=>$country, );
//$json_data[] = array("id"=>$fetch["CustomerID"], "label"=>$fetch["CustomerID"], "value"=>$fetch["CustomerID"], "address"=>$fetch["Name"], );
$json_data[] = array("id"=>$fetch["iprod"], "label"=>$fetch["iprod"], "value"=>$fetch["iprod"], "address"=>$fetch["idesc"], "batchmin"=>$fetch["BatchMin"], "batchmax"=>$fetch["BatchMax"], "batchinc"=>$fetch["Incremental"],);
}
}
$json = json_encode($json_data);
echo $json;
?>