<?php

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "selectid")
    $oc_id = $paramValue;
}

$dal = new DAL();

$sql = "SELECT OC.id, 0 AS fkid, " . 
       "(CONCAT (CO.firstname, ' ' , CO.surname, ': ', OZ.name)) AS name, " .
       "'' AS name_text " .
       "FROM organizationcontact OC, organization OZ, contact CO " .
       "WHERE OC.id = $oc_id AND OZ.id = OC.organization_id " .
       "AND CO.id = OC.contact_id LIMIT 1 ";
$result = $dal->query($sql);

echo json_encode($result);

?>

