<?php
require_once 'config.php';
//$error=false;
$errors=array();
$cities=array();
$cities1=array();
$smsflag=1;
if(isset($_GET['user_id'])){
$smsflag=$_GET['user_id'];}
$query='SELECT * FROM imagebyfolder where leaderid='.$smsflag;

$row = mysqli_query($con,$query);
     
    if (mysqli_num_rows($row) >= 1) {

			
		 while($r=mysqli_fetch_array($row)){
			 
			$cities[]=['id'=>$r['id'],'user_id'=>$r['leaderid'],'image'=>$r['image'],'folder_id'=>$r['folderid']];	
			
		}   
		//$errors['banners']=$cities;
		
    } else {
        
		
    }

	$city=$cities;
	//	shuffle($city1);
		
		if ((count($city)==0)){
        
		$errors['success']='There is no image found';
    } else {
		$errors['success']='Image by User data';
	//	shuffle($city1);	
	$errors['count']=count($city);
		$errors['imagebyfolder']=$city;   
	}
	 
	echo json_encode($errors);
	
?>