<?php
$dt=who();
echo json_encode($dt);

function who(){
  global $ar,$db;
  $dt=array();
  $now=time();
  $last_day=$now-(2*86400);
  $last_week=$now-(7*86400);


  $sql="SELECT id,name,slug,img,daily_count,weekly_count from `who` order by daily_count desc";
  //$dt['sql'][1]=$sql;
  $res=mysqli_query($db,$sql);
  if(mysqli_num_rows($res)>0){
    $dt['success']=true;
    $dt['get_at']=date("Y-m-d H:i:s");
    $dt['count']=mysqli_num_rows($res); 
    $d=0;
    while($r=mysqli_fetch_assoc($res)) {
      $dt['data'][$d]=$r;   
      $dt['data'][$d]['img']=$ar['imgurl']."".$r['img'];   
      $dt['data'][$d]['select']=0;   
      $d++;
    }
  } else {
    $dt['error']=true;
    $dt['message']="Data not found";        
  }
  return $dt;
  $db->close();
}
?>
/home/u1731472/public_html/
sub/cpapp_ekbis/api/v2/php/who.php