<?php

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

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

$dal = new DAL();
$sql = "SELECT OC.id, OZ.name as descr " .
       "FROM organizationcontact OC, organization OZ " .
       "WHERE OC.contact_id = $co_id AND OZ.id = OC.organization_id " ;
$result = $dal->query($sql);

echo json_encode($result);

?>

