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

$query='SELECT * FROM folders ';
$leaderid=$_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)){
			 $no=mysqli_query($con,"SELECT * FROM myfolder WHERE folder_id =".$r['id']." AND user_id=".$leaderid);
			if(mysqli_num_rows($no)>0){
				$ischeck=true;
			}else{
				$ischeck=false;
			}
			$cities[]=['id'=>$r['id'],'image'=>$r['image'],'name'=>$r['name'],'views'=>$r['views'],'status'=>$r['status'],'ischeck'=>$ischeck];
			
			// $cities['images']=$images;
			
			
		}   
		$errors['folders']=$cities;
		//$errors['product_images']=$images;
		$errors['success']='folders data';
    } else {
        
		$errors['success']='There is no folder found';
    }
	echo json_encode($errors);
?>