<?php
	require_once '../../autoload.php';

	
	$conn = get_dbconnection();
	
	$answer = "<results>";
	
	if ( $conn )
	{
		$sql = "select id,label from sexlist order by label";

		if ( $query = pg_query($conn,$sql) )
		{
			while ( $row = pg_fetch_row($query) )
			{
				$answer .= "<sex id=\"".$row[0]."\" label=\"".$row[1]."\"></sex>";
			}
		}
	}
	
	$answer .= "</results>";

	header ('Content-type: text/xml' );
	
	echo $answer;
?>