<?php

include('init.php');
include('libs/functions.php');
 
$state=trim($_GET['state']);
//if state is end empty, return blank
if($state=='')
  return "";
else
	$sql = "select county from tb_state_county where state_code = '" . $state . "'";
	$rs = $db->Execute($sql);

	$data = array();

	//array_push($data, $rs->Fields('county'));
	//$county = $rs->Fields('county');

//	foreach ($data as $value)
	while (!$rs->EOF)
	{
		array_push($data, $rs->fields('county'));
	$rs->MoveNext();
	}

	
//return comma seperated list of cities
echo implode(',',$data);
?>