title: PHP If statement returns false on MySQL boolean column return
body: <p>I am using the CodeIgniter framework. I'm working on the user authentication portion of my website. In my 'users' table of my MySQL database I have a column that I declared as a BOOLEAN (I am aware that it really is a TINYINT(1)) called 'verified' that denotes whether or not a user's email address has been verified. When I try to test the value of this column, my IF statement always evaluates to FALSE, even though I know for a fact the value is 1. Here is a snippet of my code:</p>
  
  <pre><code>public function authenticate_user(){
      $pw = hash('sha512', $this-&gt;salt1 . $this-&gt;input-&gt;post('password') . $this-&gt;salt2);
      $email = $this-&gt;input-&gt;post('email');
  
      $query = $this-&gt;db-&gt;get_where('users', ['email' =&gt; $email, 'password' =&gt; $pw]);
      if($query-&gt;num_rows() == 1){
          $row = $query-&gt;row_array();
          //die("verified = ".$row['verified']); &lt;-This line shows 'verified = 1' consistently when uncommented.
          if($row['verified'] == 1){
              $this-&gt;session-&gt;set_userdata([
              'name' =&gt; $row['name'],
              'email' =&gt; $email,
              'login_time' =&gt; time(),
              'last_activity' =&gt; time(),
              'session_valid' =&gt; TRUE
              ]);
              return true;
          }
          else return 'unverified';
      }
      else return false;
  }
  </code></pre>
  
  <p>When the credentials are correct, this function always returns 'unverified' and no session variables are set. The function exhibits the correct behavior when the credentials are incorrect. I have confirmed in phpMyAdmin that the column is 1, and I have confirmed that 1 is returned from the database by uncommenting the die() statement above. I have tried using true and '1' (string) in place of the integer 1 and have gotten the same result. Am I doing something wrong? Does CodeIgniter preprocess database returns in a way that would make this not work?</p>