<?
$conn=mysqli_connect("$host","$user","$pass") or die("koneksi gagal");
mysqli_select_db($conn,"$db");
$idate=date('Y-m-d');
$qsukses = mysqli_query($conn,"SELECT * FROM transaksi where kode_reseller='$kode' and tanggal>'$idate' and status=20");
$rsukses = mysqli_num_rows($qsukses);
$lsukses=number_format($rsukses,0,',','.');

$qpend = mysqli_query($conn,"SELECT * FROM transaksi where kode_reseller='$kode' and tanggal>'$idate' and status<=3");
$rpend = mysqli_num_rows($qpend);
$lpend=number_format($rpend,0,',','.');

$qgagal = mysqli_query($conn,"SELECT * FROM transaksi where kode_reseller='$kode' and tanggal>'$idate' and status>20");
$rgagal = mysqli_num_rows($qgagal);
$lgagal=number_format($rgagal,0,',','.');

$ltotal=$lsukses+$lgagal+$lpend;
