title: How to Add dynamic where clause in codeigniter query
body: <p>I am working in codeigniter and trying to make a dynamic query,
  right now my query looks like</p>
  
  <pre><code>$query = $this-&gt;db-&gt;select('name')-&gt;get('user');
  $result_array = $query-&gt;result_array();
  </code></pre>
  
  <p>My question is, how to add a dynamic where clause depending upon variable value?
  so the code will look like</p>
  
  <pre><code>$query = $this-&gt;db-&gt;select('name')-&gt;get('user');
  if(isset($name))
  {
    //add where clause here, to select specific name
  }
  $result_array = $query-&gt;result_array();
  </code></pre>