Welcome Guest, Not a member yet? Register   Sign In
Active Record LIKE on join query
#2

I may be a little confused, but you should be able to perform your query, then count the number of rows returned in that query using num_rows():

PHP Code:
$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(); 
Reply


Messages In This Thread
Active Record LIKE on join query - by Transistor - 02-15-2015, 01:09 PM
RE: Active Record LIKE on join query - by mwhitney - 02-16-2015, 11:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB