Proper use of join |
I got a problem - when i use code like this one
Code: $this->db->select('u.id, u.username, c.name', false); 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);
I think you're looking for
PHP Code: select('u.id AS user_id, ...') Although, I'm only seeing where you would get u.id anyway, you've not called for any other ids in the select statement. To get the result object: PHP Code: $obj = $this->db->result() // or row() |
Welcome Guest, Not a member yet? Register Sign In |