<?php 

require 'db.php';

$orders = $con->query("select * from orders where status ='completed'")->num_rows;
$riders = $con->query("select * from rider where status ='1'")->num_rows;
$users = $con->query("select * from user where status ='1'")->num_rows;
$total = 0;
$sels = $con->query("select * from orders where status ='completed'");
while($rows = $sels->fetch_assoc())
{
    $total += $rows['total'];
}
$sales = $total;
$rows = array('orders'=>$orders,'riders'=>$riders,'users'=>$users,'sales'=>$sales);
echo json_encode($rows);
?>