<?php

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "contact_fk")
    $co_id = $paramValue;
  else if ($paramName == "organization_fk")
    $oz_id = $paramValue;
}

$dal = new DAL();
$sql = "SELECT id FROM organizationcontact " .
       "WHERE organization_id = $oz_id AND contact_id = $co_id LIMIT 1 " ;
$oc_id = $dal->query($sql)->id;
if (null === $oc_id)
  $oc_id = 0;

echo json_encode($oc_id);

?>

