My code in Cases module hook:
$sql = "select c.id from cases c left join emails e on e.parent_id = c.id and e.parent_type = 'Cases' left join emails_text et on et.email_id = e.id where c.id = '{$focus->id}' and et.to_addrs like '%_string_%'"; $result = $focus->db->query($sql,true); $check = $focus->db->fetchByAssoc($result); if(!empty($check)){ $GLOBALS['log']->fatal("Hello World ".$check); }
I search solution in google many people suggest to using SugarQuery but it not more complex for my query or I do wrong with my code?
Please suggest me for solution.
Sugar 7.6 Ent
Thanks,
M