<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X- 
Request-With');

ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);

    include ('connect.php');

	$sql = "select * from `countries`";
	$result = mysqli_query($conn, $sql);
    $row = mysqli_fetch_assoc($result);
    
    $Arr = [];
    $i = 0;
    while($row = mysqli_fetch_assoc($result)) {
        $Arr[$i]['phonecode'] = $row['phonecode'];
        $Arr[$i]['name'] = $row['name'];
        $Arr[$i]['sortname'] = $row['sortname'];
        $i++;
    }
    
    echo json_encode($Arr,true);
    


?>