title: How to write codeigniter like query
body: <p>The problem is that it displays all the rows from db instead of displaying only those rows which contain search keywords: Please help me.</p>
  
  <pre><code>public function search($data)
  {
  
      $name = $data["name"];
      $surname = $data["surname"];
  
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('workers');
      $this-&gt;db-&gt;like('name', '%' . $name . '%');
      $this-&gt;db-&gt;or_like('surname', '%' . $surname . '%');
  
      $query = $this-&gt;db-&gt;get();    
  </code></pre>