on-internet
← Community

SELECT all columns from 3 related tables filtered by 2 LIKE clauses using CodeIgniter's query builder

Stack Overflow ·

I have an array variable like this $data[code] = "xyz123"; $data[type] = "train"; and the query I write in the model is like this: $this->db->select('*'); $this->db->from('table1'); $this->db->join('table2', 'table2.id = table1.id'); $this->db->select('table3', 'table3.id = table1.id AND table1.code LIKE $data[code] AND table1.type LIKE $data[type]'); When I try, it's not working and I think the syntax with AND and LIKE is wrong. How should I change my model method?

Comments

Sign in or sign up to comment and upvote.

No comments yet.