<?php
session_start();

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "selid")
    $ss_id = $paramValue;
}

$dal = new DAL();

$sql = "SELECT CU.id, descr AS site_descr, " .
       "mapareaid, location AS site_location, longaxis, shortaxis, orientation_id, " .
       "planshape_id, interpret_id, rationale AS rationale_note, " .
       "CU.note AS cultunitnote, topography_id, bordenizable, bordenrationale_id, " .
       "stg2recommendation, recommendrationale_id " .
       "FROM culturalunit CU, site SI, sitespatialunit SS " .
       "WHERE SS.id = $ss_id AND SS.culturalunit_id = CU.id AND SI.culturalunit_id = CU.id LIMIT 1";
$result = $dal->query($sql);
//$su_id = $result->spatialunit_id;

//$_SESSION['spatialunit'] = $su_id;

echo json_encode($result);

?>

