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

   
  
   $query="SELECT * FROM transfer_points WHERE from_user=".$_GET['user_id']." ORDER BY id DESC ";

$row = mysqli_query($con,$query);
     
    if (mysqli_num_rows($row) >= 1) {
		//$r=mysqli_fetch_array($row)	;
			
		 while($r=mysqli_fetch_array($row)){
			 
			
			 $cat=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM users WHERE id=".$r['to_user']));
			 
			$cities[]=['logid'=>$r['id'],'firstname'=>$cat['first_name'],'lastname'=>$cat['last_name'],'phone'=>$cat['phone'],'points'=>$r['points'],'date'=>date('dS F Y',strtotime($r['date']))];
			
			
			
		}   
		$errors['transferhistory']=$cities;
		
		$errors['success']='Transfer history data';
    } else {
        
		$errors['success']='There is no history found';
    }
	echo json_encode($errors);