$temp = $this->input->post('text', TRUE);
if ($temp !== '') {
$this->db->like('tbl_users.usr_Lastname', $temp, 'both');
$this->db->or_like('tbl_groups.grp_Area', $temp, 'both');
$this->db->or_like('tbl_systems.sys_Location', $temp, 'both');
// etc., etc.,
}
$this->db->select(
array(
'tbl_users.usr_Lastname',
'tbl_groups.grp_Area',
'tbl_systems.sys_Location',
// etc.,
),
FALSE
)
->join('tbl_groupmembers', 'tbl_groupmembers.gm_UserID = tbl_users.usr_UserID', 'inner')
->join('tbl_groups', 'tbl_groups.grp_ID = tbl_groupmembers.gm_GroupID', 'inner')
->join('tbl_rights', 'tbl_rights.r_GroupID = tbl_groups.grp_ID', 'inner')
->join('tbl_systems', 'tbl_systems.sys_ID = tbl_rights.r_SystemID', 'inner');
$query = $this->db->get('tbl_users');
// Record count
$jTableResult['TotalRecordCount'] = $query->num_rows();