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

$query='SELECT * FROM credit_logs WHERE user_id='.$_GET['user_id'];

$row = mysqli_query($con,$query);
     
    if (mysqli_num_rows($row) >= 1) {
		//$r=mysqli_fetch_array($row)	;
			
		 while($r=mysqli_fetch_array($row)){
			$cities[]=['logid'=>$r['id'],'user_id'=>$r['user_id'],'topupcash'=>$r['credits'],'earnpoint'=>$r['points'],'voucherpoints'=>$r['voucher'],'date'=>$r['created_at']];
			
			
			
		}   
		$errors['cashlog']=$cities;
		
		$errors['success']='Cash log history data';
    } else {
        
		$errors['success']='There is no log found';
    }
	echo json_encode($errors);
?>