on-internet
← Community

MySQL SELECT query in CodeIgniter WHERE a comma-separated column contains a specific whole value

Stack Overflow ·

This is my mysql query: $acountry = 1; $this->db->where_in('varcountry', $acountry); $val = $this->db->get('tblagencies')->result(); In database table the varcountry filed is stored like this 1,2,3,4; its type is varchar. Each row in the table has multiple countries -- that is the reason to use varchar datatype. I want to select table rows which have $acountry value in the field varcountry. How can I do that? Is the above code correct?

Comments

Sign in or sign up to comment and upvote.

No comments yet.