<?php

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

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

$dal = new DAL();

$sql = "SELECT CO.id,       0 AS fkid, " . 
       "OC.contact_id,      '' AS contact_id_text, " .
       "OC.organization_id, '' AS organization_id_text, " .
       "CO.firstname,      '' AS firstname_text, " .
       "CO.middlename,     '' AS middlename_text, " .
       "CO.title,           '' AS title_text " .
       "FROM contact CO, organizationcontact OC " .
       "WHERE CO.id = $co_id AND OC.contact_id = CO.id " .
       "LIMIT 1 ";
$result = $dal->query($sql);

echo json_encode($result);

?>

