<?php
require_once(dirname(__FILE__) . "/../../../dbcon.php");
require_once(dirname(__FILE__) . "/../../../functions/tool_functions.php");

$district = $_POST['district'];
$locations = array();
$q = "select * from cyprus_locations where 1=1 ";
if($district != "") {
	$q .= " and dcode='$district' ";
}
$q .= "order by location asc;";

//echo $q;

$r = @mysql_query($q);
if($r && mysql_num_rows($r) > 0) {
	while ($row = mysql_fetch_assoc($r)) {
		$locations [] = array('lcode' => $row['lcode'], 'location' => stripslashes($row['location']));
	}
}
echo array2json($locations);
?>