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

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

$dal = new DAL();

$sql = "SELECT SU.id, " .
       "id AS name_id, SU.name AS name_id_text, " . 
       "DE.value,      '' AS value_text, " .
       "PO.pos,        '' AS pos_text, " . 
       "EL.mark,       '' AS mark_text " .
       "FROM lot LO, spatialunitlot SL, depth DE, " .
       "spatialunitlotpoints SLP, elevation EL, points PO " .
       "WHERE LO.id = $lo_id AND SL.lot_id = LO.id " .
       "AND DE.spatialunitlot_id = SL.id " .
       "AND SLP.spatialunitlot_id = SL.id " .
       "AND EL.spatialunitlotpoints_id = SLP.id " .
       "AND PO.id = SLP.points_id LIMIT 1 " ; 
$result = $dal->query($sql);
 
echo json_encode($result);

?>

