<?php

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

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

$dal = new DAL();

$sql = "SELECT PR.id,         0 AS fkid, " .
       "OC.contact_id,        '' AS contact_id_text, " .
       "OC.organization_id,   '' AS organization_id_text, " .
       "POC.project_id,       PR.name AS project_id_text, " .
       "PR.site_name,         '' AS name_text, " .
       "PR.development_refno, '' AS development_refno_text, " .
       "PR.department_id,     '' AS department_id_text, " .
       "PR.refno,             '' AS refno_text, " .
       "PR.licence_no,        '' AS licence_no_text, " .
       "PR.stage_id,          '' AS stage_id_text " .
       "FROM project PR, projectorganizationcontact POC, " .
       "organizationcontact OC " .
       "WHERE PR.id = $pr_id AND POC.project_id = PR.id " .
       "AND OC.id = POC.organizationcontact_id " .
       "LIMIT 1 ";
$result = $dal->query($sql);

echo json_encode($result);

?>

