<?php

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

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

$dal = new DAL();
$sql = "SELECT OC.id,  " .
       "CONCAT(CO.firstname, ' ', CO.surname) AS 'Contact Name', " .
       "OZ.name AS 'Contact Organization', " .
       "OC.email AS 'Contact Email' " .
       "FROM contact CO, organizationcontact OC, organization OZ " .
       "WHERE CO.id = $co_id AND OC.contact_id = CO.id " .
       "AND OZ.id = OC.organization_id " ;
$result = $dal->query($sql);

echo json_encode($result);

?>

