title: Codeigniter where clause is not working
body: <p>I'm new to codeigniter I've a function in model with this code</p>
  
  <pre><code>    $this-&gt;db-&gt;select("id, username, password");
      $this-&gt;db-&gt;from(TABLE_USERS);
      $where = "username='".$username."' AND password='".$password."' AND status='1'";
      $this-&gt;db-&gt;where($where);
      $this-&gt;db-&gt;limit(1);
      $login = $this-&gt;db-&gt;get();
      echo '&lt;pre&gt;';print_r($login);echo '&lt;/pre&gt;';die('Call');
  </code></pre>
  
  <p>And it is giving this error</p>
  
  <pre><code>A Database Error Occurred
  
  Error Number: 1054
  
  Unknown column 'username='admin'' in 'where clause'
  
  SELECT `id`, `username`, `password` FROM (`users`) WHERE `username='admin'` AND password='7c4a8d09ca3762af61e59520943dc26494f8941b' AND status='1' LIMIT 1
  
  Filename: C:\wamp\www\customadmin\system\database\DB_driver.php
  
  Line Number: 330
  </code></pre>
  
  <p>after where clause this should be like this</p>
  
  <pre><code>WHERE `username`='admin' AND `password`='7c4a8d09ca3762af61e59520943dc26494f8941b'
  </code></pre>
  
  <p>instead of this</p>
  
  <pre><code>WHERE `username='admin'` AND password='7c4a8d09ca3762af61e59520943dc26494f8941b'
  </code></pre>
  
  <p>I've searched every where like <a href="http://ellislab.com/codeigniter/user-guide/database/active_record.html" rel="nofollow noreferrer">Active Record Class</a> and also at stackoverflow <a href="https://stackoverflow.com/questions/2975987/codeigniter-how-to-use-where-clause-and-or-clause">CodeIgniter WHERE clause</a> and other forums but didn't find solution related with my problem. Thanks in advance.</p>