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

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

$dal = new DAL();
      
$sql = "SELECT SL.id, SU.name AS 'Test-pit Name', space(1) AS Lots, " .
       "space(1) AS 'Total Artifacts' " .
       "FROM culturalunitspatialunit CS, spatialunit SU, spatialunitlot SL " .
       "WHERE CS.culturalunit_id = $cu_id AND SU.id = CS.spatialunit_id " .
       "AND SU.spatialunitype_id = 5 AND SL.spatialunit_id = SU.id "; 
$result = $dal->query($sql);

echo json_encode($result);

?>

