Welcome Guest, Not a member yet? Register   Sign In
how codeigniter join two tables to have both Id columns
#3

(03-27-2019, 03:39 AM)InsiteFX Wrote: Example:

stackoverflow - codeigniter join 2 table data

Thank you for your reply I change my code as below. now i access both id from two table as different name
Code:
$this->db->select('*,comment.id as comment_id,users.id as userid');
       $this->db->from('comment');
       $this->db->where('user_id', $user_id);
       $this->db->where('project_id', $projectId);
       $this->db->join('users', 'comment.user_id_from = users.id');
       $this->db->order_by("comment.id", "asc");
       return $this->db->get()->result_array();
Reply


Messages In This Thread
RE: how codeigniter join two tables to have both Id columns - by hamid3d - 03-27-2019, 04:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB