title: CodeIgniter Active Record multiple "where" and "or" statements
body: <p>I have the following Active Record query.</p>
  
  <pre><code>//Example 1
  public function info($school, $class, $student, $keyword)
  {
      $this-&gt;db-&gt;where('school.id', $school);
      $this-&gt;db-&gt;where('class.id', $class);
      $this-&gt;db-&gt;where('student.id', $student);
  
      $this-&gt;db-&gt;or_where('school.description', $keyword);
      $this-&gt;db-&gt;or_where('class.description', $keyword);
      $this-&gt;db-&gt;or_where('student.description', $keyword); 
  
      return $this-&gt;db-&gt;get('info')-&gt;result();
  }
  </code></pre>
  
  <p>I want to group the bottom 3 "or_where" statements so they are included with the top 3 "where" statements. The solution I came up with was this...</p>
  
  <pre><code>//Example 2
  public function info($school, $class, $student, $keyword) 
  {
      $this-&gt;db-&gt;where('school.description', $keyword);
      $this-&gt;db-&gt;where('school.id', $school);
      $this-&gt;db-&gt;where('class.id', $class);
      $this-&gt;db-&gt;where('student.id', $student);
  
      $this-&gt;db-&gt;or_where('class.description', $keyword);
      $this-&gt;db-&gt;where('school.id', $school);
      $this-&gt;db-&gt;where('class.id', $class);
      $this-&gt;db-&gt;where('student.id', $student);
  
      $this-&gt;db-&gt;or_where('student.description', $keyword); 
      $this-&gt;db-&gt;where('school.id', $school);
      $this-&gt;db-&gt;where('class.id', $class);
      $this-&gt;db-&gt;where('student.id', $student);
  
      return $this-&gt;db-&gt;get('info')-&gt;result();
  }
  </code></pre>
  
  <p>This works fine, but is there a way to do this without repeating code?</p>