<?php

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

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

if ($cu_id > 0) {  
  $dal = new DAL();

  $sql = "SELECT CS.culturalunit_id, " .
//         "PS.projectparcel_id, '' AS projectparcel_id_text, " .
//         "POS.projectworkdayoperation_id AS dailyoperation_id, '' AS dailyoperation_id_text, " . 
         "SL.lot_id,         '' AS lot_id_text, " .
         "PI.interval_id,    '' AS interval_id_text, " .
         "PI.expansion_id,   '' AS expansion_id_text, " .
         "PI.observation_id, '' AS observation_id_text, " .
         "PI.collection_id,  '' AS collection_id_text, " .
         "PI.station_id,     '' AS station_id_text, " .
         "PI.note,           '' AS note_id_text " .
         "FROM culturalunitspatialunit CS, pedestrianintensification PI, " .
         "spatialunit SU, spatialunitlot SL " .
         "WHERE CS.culturalunit_id = $cu_id AND PI.culturalunit_id = $cu_id " . 
         "AND SU.id = CS.spatialunit_id AND SU.spatialunitype_id = 8 " .
         "AND SL.spatialunit_id = SU.id " .
         "LIMIT 1 ";
  $result = $dal->query($sql);
}  

echo json_encode($result);

?>

