<?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 LO.id, name AS selectlot_name, DE.value AS lot_depth, PO.pos AS elev_pos, EL.mark As elev_mark " .
       "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);

?>

