title: Codeigniter PDO emulate prepare
body: <p>I have been reading around and people say that when setting up your connection with your Database that you should add </p>
  
  <pre><code>$dbConnection-&gt;setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
  </code></pre>
  
  <p>Telling PDO to disable emulated prepared statements using real PDO statements. </p>
  
  <p>How do I set up this up in Codeigniter? </p>
  
  <p>I am using codeigniter 2.1.3</p>
  
  <p>Edit 1: </p>
  
  <p>How I connect now : </p>
  
  <pre><code>$active_group = 'default';
  $active_record = FALSE;
  
  $db['default']['hostname'] = 'mysql:host=localhost';
  $db['default']['username'] = 'XXXXXXX';
  $db['default']['password'] = 'XXXXXXXXXX';
  $db['default']['database'] = 'XXXXXXX';
  $db['default']['dbdriver'] = 'pdo';
  $db['default']['dbprefix'] = '';
  $db['default']['pconnect'] = FALSE;
  $db['default']['db_debug'] = TRUE;
  $db['default']['cache_on'] = FALSE;
  $db['default']['cachedir'] = '';
  $db['default']['char_set'] = 'utf8';
  $db['default']['dbcollat'] = 'utf8_general_ci';
  $db['default']['swap_pre'] = '';
  $db['default']['autoinit'] = TRUE;
  $db['default']['stricton'] = FALSE;
  </code></pre>
  
  <p>and a query example is : </p>
  
  <pre><code>function validate_login()
      {
      $bcrypt = new Bcrypt(17);   
      $sql = "SELECT * FROM users WHERE username = :user";
      $loginQ = $this-&gt;db-&gt;conn_id-&gt;prepare($sql);
      $loginQ-&gt;bindParam(':user', $this-&gt;input-&gt;post('username'));
      $loginQ-&gt;execute(); 
      $row = $loginQ-&gt;fetch();
      $hash = $row['password'];
      $password = $this-&gt;input-&gt;post('password');
      $verified = $bcrypt-&gt;verify($password, $hash);
  
          if($bcrypt-&gt;verify($password, $hash))
          {
              return $loginQ;
          }
      }
  </code></pre>