title: Unnecessary quotes adding on sql while executing - codeigniter
body: <p>while trying to do a select query I came into a situation where unnecessary quotes are injecting to it on execution. I'm working in Codeigniter. Trying to selects record which having first 4 characters same.
  Code is:</p>
  
  <pre><code>$calendar = $this-&gt;db-&gt;select("c.first_name as cfn, u.first_name as ufn", false)
          -&gt;from("{$this-&gt;tables['contacts']} c")
          -&gt;join("{$this-&gt;tables['users']} u", " SUBSTR( u.first_name , 1 , 4) = SUBSTR( c.first_name , 1 , 4) ", '')
          -&gt;where(array('c.status' =&gt; 1, 'c.first_name !=' =&gt; ''))
          -&gt;get()-&gt;result_array();
  </code></pre>
  
  <p>I'm getting an error as:</p>
  
  <pre><code>FUNCTION dbname.SUBSTR does not exist. Check the 'Function Name Parsing 
  and Resolution' section in the Reference Manual
  
  SELECT c.first_name as cfn, u.first_name as ufn FROM (`contacts` c) 
  JOIN `users` u ON `SUBSTR`( `u`.`first_name` , 1 , 4) = SUBSTR( c.first_name , 1 , 4) 
   WHERE `c`.`status` = 1 AND `c`.`first_name` != ''
  </code></pre>
  
  <p><em>`SUBSTR`</em> on query is unexciting(single quote for SUBSTR).</p>