find a value exist or not using sql query |
[eluser]Bigil Michael[/eluser]
My Table Structure is like this id name privileges 1 A 1,2,3,4,5 my Requirement is to find if 3 exist in column privileges if yes return true else return false I write the query like this Code: $this->db->where_in('privileges', 3); but it doesn't work can any one help me ??
[eluser]ivantcholakov[/eluser]
Your field "privileges" does not contain atomized values. You need an additional table. http://en.wikipedia.org/wiki/First_normal_form
[eluser]Tpojka[/eluser]
Yes, additional table would be neat solution. Also, can you show (explain) us how do you insert records (privileges) into table? Or can you echo that line (i.e. $result['privileges'])?
[eluser]CroNiX[/eluser]
Code: $this->db->where_in('privileges', array(3)); //array here |
Welcome Guest, Not a member yet? Register Sign In |