![]() |
join failed - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: join failed (/showthread.php?tid=70744) |
join failed - davy_yg - 05-23-2018 Hello, I wonder why I cannot see the result of this after join. If I comment out the join it does return a value. I do have wishlists table with user_id column and users table with id column. I do have similar id. I wonder why it does not return any value? UserModel.php function enduser_table($data) { //merchants.id = orders.merchant_id $this->db->select('*'); $this->db->from('users'); $this->db->join('wishlists', 'wishlists.user_id = users.id'); //$this->db->join('orders', 'orders.user_id = users.id'); $this->db->where('id', $data); return $this->db->get()->result(); } RE: join failed - InsiteFX - 05-24-2018 If you need a specific type of JOIN you can specify it via the third parameter of the function. Options are: left, right, outer, inner, left outer, and right outer. RE: join failed - davy_yg - 05-24-2018 I try using : function enduser_table($data) { $this->db->select('*'); $this->db->from('users'); $this->db->join('wishlists', 'wishlists.user_id = users.id', left); $this->db->where('id', $data); return $this->db->get()->result(); } I already try left, right and inner and none of them works. RE: join failed - nalletje - 05-24-2018 Do you have have error reporting on? You might have encountered a ambiguous error... try $this->db->where('users.id', $data); or change users by the table the ID should be from. |