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

$query='SELECT * FROM smsbanner_view_log where user_id='.$_GET['user_id'].' AND credit > 0  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)){
			 
			$cities[]=['id'=>$r['id'],'user_id'=>$r['user_id'],'image_id'=>$r['smsbanner_id'],'created_at'=>date('dS F Y',strtotime($r['created_at'])),'credit'=>$r['credit']];
			
			// $cities['images']=$images;
			
			
		}   
		$errors['pointhistory']=$cities;
		//$errors['product_images']=$images;
		$errors['success']='pointhistory data';
    } else {
        
		$errors['success']='There is no pointhistory found';
    }
	echo json_encode($errors);
?>