<?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 OC.id,      OC.organization_id AS fkid, " . 
       "OC.email,          '' AS email_text, " .
       "AD.department,     '' AS department_text, " .
       "AD.suite,          '' AS suite_text, " .
       "AD.addresstype_id, '' AS addresstype_id_text, " .
       "AD.pobox,          '' AS pobox_text, " .
       "AD.streetno,       '' AS streetno_text, " .
       "AD.streetname,     '' AS streetname_text, " .
       "AD.streetype,      '' AS streetype_text, " .
       "AD.streetdir,      '' AS streetdir_text, " .
       "AD.ruralroute,     '' AS ruralroute_text, " .
       "AD.city,           '' AS city_text, " .
       "AD.province,       '' AS province_text, " .
       "AD.postcode,       '' AS postcode_text, " .
       "AD.country,        '' AS postcode_text, " .
       "note,              '' AS note_text, " .
       "OC.login,          '' AS login_text, " .
       "OC.password,       '' AS password_text " .
       "FROM organizationcontact OC, address AD " .
       "WHERE OC.contact_id = oc_id AND AD.id = OC.address_id " .
       "LIMIT 1 ";
$result = $dal->query($sql);

echo json_encode($result);

?>

