AnsweredAssumed Answered

Query not return any result in logic hook but query work in MySQL workbench

Question asked by Autchara Chaiprom on May 4, 2016
Latest reply on May 8, 2016 by Autchara Chaiprom

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

Outcomes