Welcome Guest, Not a member yet? Register   Sign In
count_all with joint two table
#1

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'); 
Reply
#2

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

Reply
#3

(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'); 
Reply
#4

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');

Reply




Theme © iAndrew 2016 - Forum software by © MyBB