if ($source == 'inbox')
$problem->where('assigned_to_id',$user_id);
else
$problem->where('owner_id',$user_id);
if (isset($order)) $problem->db->order_by($order);
$problem->limit($iDisplayLength,$iDisplayStart);
$problem->get();
The include_related does not work for some reason... (might want to look into that?)
and for some reason the sql this generates is this:
Quote:SELECT `problems`.*
FROM (`problems`)
LEFT OUTER JOIN `members` as members ON `members`.`id` = `problems`.`member_id`
LEFT OUTER JOIN `problem_statuses` as status_problem_statuses ON `status_problem_statuses`.`id` = `problems`.`status_id`
WHERE (
`members`.`name` LIKE '%%'
OR `members`.`sid` LIKE '%%'
OR `status_problem_statuses`.`name` LIKE '%%'
)
AND `problems`.`id` IN ( LIST OF IDs REMOVED )
AND `problems`.`assigned_to_id` = '2'
ORDER BY `problems`.`id` asc
LIMIT 10
It works but should it also be joining the users table twice??? (owner, assigned_to)