Codeigniter 3x Query Builder class seems to be generating extra segments to my query <p>I am using the latest version of the Codeigniter framework for PHP. Here is my code.</p> <pre><code>public function get_user_by_username( $username ) { $this-&gt;db-&gt;where( 'username', strtolower( $username ) ); $q = $this-&gt;db-&gt;get( 'users', 1 ); foreach( $q-&gt;result() as $row ) { return $row; } return NULL } </code></pre> <p>I called the <strong>last_query()</strong> method to get the query that was generating the problem and this pops up messing up the entire query. I didn't code this. Codeigniter is generating this on its own.</p> <pre><code>SELECT * FROM `users` WHERE `serial` IS NULL AND `password` IS NULL AND `username` = '[username]' LIMIT 1 </code></pre> <p>I need Codeigniter to generate this instead as I expected.</p> <pre><code>SELECT * FROM `users` WHERE `username` = '[username]' LIMIT 1 </code></pre> <p>I'm just now starting to code with Codeigniter 3x after using version 2x for the last couple of years. Thanks in advance.</p>