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

$query='SELECT * FROM categories WHERE city_id='.$_GET['city_id'];

$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'],'name'=>$r['name'],'city_id'=>$r['city_id']];
			
			
		}   
		$errors['categories']=$cities;
		$errors['success']='categories data';
    } else {
        
		$errors['success']='There is no categories found';
    }
	echo json_encode($errors);
?>