<?php

require_once($_SERVER['DOCUMENT_ROOT'] . '/sys/db.php');

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "selectid")
    $su_id = $paramValue;
}

$dal = new DAL();

$sql = "SELECT PF.id, FO.name AS text " .  
       "FROM spatialunitfop SF, parcelfop PF, fop FO " .
       "WHERE SF.spatialunit_id = $su_id AND PF.id = SF.parcelfop_id " .
       "AND FO.id = PF.fop_id " .
       "ORDER BY FO.name " ; 
$result = $dal->query($sql);

echo json_encode($result);

?>

