title: password_hash() and password_verify() issues with Codeigniter 3.1.10
body: <p>I am trying to create a login/register function by using password_hash() and password_verify.</p>
  
  <p>Here is the simple code that I wrote. The result that I get is "invalid Password" when I try to log in.</p>
  
  <p>What am I missing?</p>
  
  <p><strong>Register Controller</strong></p>
  
  <pre><code> public function register() {
      $email = $this-&gt;input-&gt;post('email');
      $password = password_hash($this-&gt;input-&gt;post('password'), PASSWORD_BCRYPT);
  
   $insert_db = $this-&gt;db-&gt;insert('users',[
          'email' =&gt; $email, 
          'password' =&gt; $password
  }
  </code></pre>
  
  <p>I can see that password_hash function seems to be fine, it storing random characters in the database. However, when I try to login with those details it doesn't work.</p>
  
  <p>Database: field: varchar(255)</p>
  
  <p><strong>Login controller:</strong> </p>
  
  <pre><code>public function verifyLogin() {
   $email = $this-&gt;input-&gt;post('email');
   $password = ($this-&gt;input-&gt;post('pswd'));
  
   // load model 
   $this-&gt;load-&gt;model('Login_model');
   $account = $this-&gt;Login_model-&gt;verifyLogin($email, $password);
  
   if ($account) {
    //if user found, show success msg
      echo "successful login";
    } else {
      echo "invalid password";
    }
  
  }
  </code></pre>
  
  <p><strong>Login Model</strong></p>
  
  <pre><code> public function verifyLogin($email, $password) { 
      $query = $this-&gt;db-&gt;where([ 'email'=&gt; $email])
                        -&gt;get('users');
  
      if ($query-&gt;num_rows() == 1) {
  
              // hash fetched from db 
              $record = $query-&gt;row();
              $dbPassword = $record-&gt;password;
  
              // Hash length showing 60         
                 echo strlen($dbPassword);
  
              if (password_verify($password, $dbPassword)) {
                  return true;
              } else {
                  return false;
              }
  
      }
  
      }
  </code></pre>
  
  <p><strong>Login Form</strong></p>
  
  <pre><code>&lt;?= form_open('Login/verifyLogin'); ?&gt;
  &lt;label&gt;Email&lt;/label&gt;
  ?php echo form_error('login-email);'?&gt;
  &lt;?php echo form_input(['name'=&gt;'login-email', 'value' =&gt; set_value('login-email')]); ?&gt;
  &lt;label&gt;Password&lt;/label&gt;
  &lt;?php echo form_error('login-password'); ?&gt;
  &lt;?php echo form_password(['name'=&gt;'login-password', 'value' =&gt; set_value('login-password')]);?&gt;
   &lt;?php echo form_submit(['type' =&gt; 'submit', 'value' =&gt; 'Login']); ?&gt;
  &lt;?= form_close(); ?&gt;
  </code></pre>