Welcome Guest, Not a member yet? Register   Sign In
Proper use of join
#1

I got a problem - when i use code like this one
Code:
$this->db->select('u.id, u.username, c.name', false);
$this->db->from('user as u');
$this->db->join('companies as c', 'u.company_id = c.id');
$this->db->where('LOWER(u.username)=', strtolower('foobar'));
$query = $this->db->get();

i loose all my id.
I tried to change names of id fields to something like user_id, but CI don't work well without column named precisely id.

How to don't loose id field?
And is possible to get an object representation after a querry that uses a join statement?
$query->custom_result_object(self::$this_table_name);
Reply


Messages In This Thread
Proper use of join - by glorsh66 - 10-17-2017, 10:10 AM
RE: Proper use of join - by glorsh66 - 10-17-2017, 10:11 AM
RE: Proper use of join - by enlivenapp - 10-18-2017, 10:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB