<?php

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "optionsid")
    $pr_id = $paramValue;
}

$dal = new DAL();
$sql = "SELECT 0 AS id, 'Select' AS text " .
       "UNION ALL " .
       "SELECT PP.id, PA.name as text FROM parcel PA, projectparcel PP " .
       "WHERE PP.project_id = $pr_id AND PA.id = PP.parcel_id " ;
$result = $dal->query($sql);

echo json_encode($result);

?>

