<?php
require_once 'config.php';
//$error=false;
$errors=array();
$cities=array();

$query="SELECT rl.*,g.* FROM reffer_log AS rl INNER JOIN smsgroups AS g ON rl.group_id = g.id WHERE user_id=".$_GET['user_id']." ORDER BY rl.id DESC ";

$row = mysqli_query($con,$query);
   
    if (mysqli_num_rows($row) >= 1) {
		//$r=mysqli_fetch_array($row)	;
			
		 while($r=mysqli_fetch_array($row)){
			
			$cities[]=['id'=>$r['id'],'user_id'=>$r['user_id'],'group_name'=>$r['group_name'],'phone'=>$r['phone'],'point'=>$r['point'],'created_at'=>date('dS F Y',strtotime($r['created_at']))];
			
			// $cities['images']=$images;
			
			
		}   
		$errors['trendwallet']=$cities;
		//$errors['product_images']=$images;
		$errors['success']=true;
		$errors['message']='sms data';
    } else {
        
		$errors['success']=false;
		$errors['message']='There is no message found';
    }
	echo json_encode($errors);
?>