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

$query="SELECT * FROM cities WHERE country_id ='".$_GET['country_id']."' AND status=1 ORDER BY id DESC";

$row = mysqli_query($con,$query);
     
    if (mysqli_num_rows($row) >= 1) {
		
			
		 while($r=mysqli_fetch_array($row)){
			$cities[]=['id'=>$r['id'],'country_id'=>$r['country_id'],'name'=>$r['name'],'lat'=>$r['lat'],'lang'=>$r['lang'],'picture'=>$r['picture']];
			
			
		}   
		$errors['cities']=$cities;
		$errors['success']='Cities data';
    } else {
        
		$errors['success']='There is no cities found';
    }
	echo json_encode($errors);
?>