CodeIgniter Forums
count_all with joint two table - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 2.x (https://forum.codeigniter.com/forumdisplay.php?fid=18)
+--- Thread: count_all with joint two table (/showthread.php?tid=280)



count_all with joint two table - jaysondotp - 11-17-2014

Hi coders.

i create pagination but i found out that there is count_all, and now my problem is, i have no idea how to join two table with count_all. 

code below is i need to convert into count_all so that i need call from here.

PHP Code:
$config['total_rows'] = $this->public_base_model->count_confirmation(); 


PHP Code:
$this->db->select('pull_out.*,users.*');
$this->db->from('pull_out');
$this->db->join('users''pull_out.userid = users.userid''left'); 



RE: count_all with joint two table - Rufnex - 11-18-2014

On your result, you have a method for counting : $query->num_rows();


RE: count_all with joint two table - jaysondotp - 11-18-2014

(11-18-2014, 02:37 AM)Rufnex Wrote: On your result, you have a method for counting : $query->num_rows();

Okay, thanks for your help.. and i got the solution.. 
PHP Code:
$this->db->select('pull_out','users'); 



RE: count_all with joint two table - Rufnex - 11-19-2014

Ah, no i understand what you tried to do. Not a count but a select over all fields. if you have the same names in your joined tables you have to select as

Code:
$this->db->select('pull_out');
$this->db->select('users.a, users.b, users.c as xyz');