<?php
 
include 'dbconfig.php';
 
// Create connection

//$date1=$_GET['date1'];
//$date2=$_GET['date2'];
//$kodecab=$_GET['kodecab'];
//$item_code=$_GET['item_code'];
$customer=$_POST['customer'];

//echo $notrans;
 
$conn = mysqli_connect($servername, $username, $password, $dbname);
 
// Check connection
 
if (!$conn) {
 
    die("Connection failed: " . mysqli_connect_error());
 
}
 
//$sql3="select LIMIT 2 * from TbCustomer where custname like '%".$customer."%' or nohp like '%".$customer."%' order by custname asc";
$sql3="select * from TbCustomer where custname like '%".$customer."%' or  nohp like '%".$customer."%' order by custname asc LIMIT 10";
$res3 = mysqli_query($conn, $sql3);

$sql5=mysqli_query($conn, "select * from TbCustomer where custname like '%".$customer."%' or nohp like '%".$customer."%' order by custname asc");
$sql5b=mysqli_num_rows($sql5);


 $items = array();
 
 if (mysqli_num_rows($res3) > 0) {
 
    while($row = mysqli_fetch_object($res3)){
 
        array_push($items, $row);
 
//$result["errorcode"] = "1";
 
    $result["data"] = $items;
 
}}
else
{
 
       $result["errormsg"] = "failed";
 
}
 
$result["jum"] = strval($sql5b);

echo json_encode($result);
 
mysqli_close($conn);

 
?>
