title: PHP - Search multiple words for search terms
body: <p>I'm setting up a PHP function to return a result from the database based on what the user is looking for by a search bar.</p>
  <p>In the database I have this:
  &quot;<strong>skirt blue red</strong>&quot;</p>
  <p>In search bar, if the user writes &quot;<strong>skirt red</strong>&quot; the result should come out, as <code>&quot;like '%skirt%red%'&quot;</code></p>
  <p>I am trying in this way but it doesn't work.</p>
  <pre class="lang-php prettyprint-override"><code>    if (isset($conds['searchterm'])) {
                  $search1 = explode(&quot; &quot;, ($conds['searchterm']));
                   { 
          $cond_name1 = $search1[0];
              $cond_name2 = $search1[1];
              $cond_name3 = $search1[2];
              $cond_name4 = $search1[3];
              $cond_name5 = $search1[4];
  
                      
          $this-&gt;db-&gt;group_start();
          $this-&gt;db-&gt;like( 'table.title', $cond_name1 );
          $this-&gt;db-&gt;and_like( 'table.title', $cond_name2 );
          $this-&gt;db-&gt;and_like( 'table.title', $cond_name3 );
              $this-&gt;db-&gt;and_like( 'table.title', $cond_name4 );
              $this-&gt;db-&gt;and_like( 'table.title', $cond_name5 );
          this-&gt;db-&gt;group_end();
                  }
              }
  </code></pre>
  <p>What is wrong?</p>
  <p>Honestly I'm stuck on this.</p>