<?php

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "currid")
    $su_id = $paramValue;
}
  
$dal = new DAL();

$sql = "SELECT PH.id, PH.filename, PH.cardinal_id, PH.phototag_id, " .
       "PH.time_taken, PH.note " .
       "FROM operationspatialunit OS, " .
       "operationspatialunitphoto OSP, photo PH " .
       "WHERE OS.spatialunit_id = $su_id " .
       "AND OSP.operationspatialunit_id = OS.id " .
       "AND PH.id = OSP.photo_id" ;
$result = $dal->query($sql);

echo json_encode($result);
?>

