<?php
 
include 'dbconfig.php';
 
// Create connection
$nopos=$_POST['nopos'];
$tipe=$_POST['tipe'];
//$kodecab=$_POST['kodecab'];
 
$conn = mysqli_connect($servername, $username, $password, $dbname);
 
// Check connection
 
if (!$conn) {
 
    die("Connection failed: " . mysqli_connect_error());
 
}
 
//$result["errorcode"]="0";

//echo $cari."<br>";



 
 

 
$sql = "SELECT notrans_link,max(tgl_rec) as tgl_rec,custid,custname,nohp FROM Trans1sub where typetrans='$tipe' and  notrans_link like '%$nopos%' group by notrans_link,custid,custname,nohp order by tgl_rec desc";
 
$res = mysqli_query($conn, $sql);


$sql11 = mysqli_query($conn,"SELECT notrans_link,max(tgl_rec) as tgl_rec,custid,custname,nohp FROM Trans1sub where typetrans='$tipe' and  notrans_link like '%$nopos%' group by notrans_link,custid,custname,nohp order by tgl_rec desc");
$sql12=mysqli_num_rows($sql11) ;
 
$items = array();
 
if (mysqli_num_rows($res) > 0) {
 
    while($row = mysqli_fetch_object($res)){
 
        array_push($items, $row);
 
//$result["errorcode"] = "1";
 
    $result["data"] = $items;
 
}}
else
{
 
       $result["data"] = "failed";
 
}
 
 $result["jum"] = strval($sql12);
echo json_encode($result);
 
 
 
mysqli_close($conn);
 
?>
