title: codeigniter active record where_in
body: <p>i'm using codeigniter 2xx.
  Mysql table:  </p>
  
  <pre><code>create table hobby (
  id int,
  school varchar,
  classes varchar,
  basketball text,  {12,15,17...}
  football text,  {12,18,20...}
  swimming text {11,15,....}
  );
  </code></pre>
  
  <p>i intend to store the student id as serialized(array(integer)) in the mysql table fields like basketball, football and swimming.<br>
  I want to find out a particular class student id (eg. 12) if he has join any hobby or more than 1 hobby using codeigniter active records method but stuck. Below is my code:  </p>
  
  <pre><code>$this-&gt;db-&gt;select('basketball','football','swimming');
  $this-&gt;db-&gt;or_where('school', $data)-&gt;where('classes', $classid)-&gt;where_in($student_id, 'basketball');
  $this-&gt;db-&gt;or_where('school', $data)-&gt;where('classes', $classid)-&gt;where_in($student_id, 'football');
  $this-&gt;db-&gt;or_where('school', $data)-&gt;where('classes', $classid)-&gt;where_in($student_id, 'swimming');
  $query = $this-&gt;db-&gt;get('hobby');  
  </code></pre>
  
  <p>Or is there a better way to store &amp; handle the information?  </p>