<?php
session_start();

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

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

$dal = new DAL();
$sql = "SELECT SU.id, SU.id AS selectpart_name, P.location AS loc_descr, SU.longaxis, SU.shortaxis, " .
       "SU.mapareaid, SU.longdirection_id, P.topography_id, P.landuse_id, P.descr AS add_descr " .
       "FROM spatialunit SU, part P " .
       "WHERE SU.id = $su_id AND P.spatialunit_id = SU.id LIMIT 1";
$result = $dal->query($sql);

$_SESSION['spatialunit'] = $su_id;

echo json_encode($result);

?>

