<?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 OC.id, POC.contactype_id AS addValue, " .
       "CONCAT (CO.surname, ': ', OZ.name) AS inpValue " .
       "FROM projectorganizationcontact POC, organizationcontact OC, " .
       "organization OZ, contact CO " .
       "WHERE POC.project_id = $pr_id AND OC.id = POC.organizationcontact_id " .
       "AND OZ.id = OC.organization_id AND CO.id = OC.contact_id " ;
$result = $dal->query($sql);

echo json_encode($result);
?>

