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

$query='SELECT * FROM countries ';

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