<?
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select accounts.id as account_id,accounts.name as account_name from contacts inner join accounts_contacts on contacts.id=accounts_contacts.contact_id inner join accounts on accounts.id=accounts_contacts.account_id where contacts.id='".$_REQUEST['contact_id']."'"));
$account_name=$r['account_name'];
$account_id=$r['account_id'];
if($_REQUEST['id']==1)print $account_id;
else print $account_name;
?>
