title: PHP - database column data query returning another columns data
body: <p>I am writing a basic PHP login system for a school project, I am currently trying to implement email activation. Here is a snippet of my code.</p>
  
  <pre><code>        $query = " 
          SELECT 
              id, 
              username, 
              password, 
              salt, 
              email
              useractivestatus
          FROM users 
          WHERE 
              username = :username 
      "; 
  
      // The parameter values 
      $parameters = array( 
          ':username' =&gt; $_POST['username'] 
      ); 
  
      try 
      { 
          // Execute the query against the database 
          $stmt = $db-&gt;prepare($query); 
          $result = $stmt-&gt;execute($parameters); 
      } 
      catch(PDOException $err) 
      { 
  
          die("Failed to run query: " . $err-&gt;getMessage()); 
      } 
      $row = $stmt-&gt;fetch();
      if($row) 
      {
      if($active != $row['useractivestatus'] );
      {
          die("Account has not been activated");
      }
  </code></pre>
  
  <p>The problem is using var_dump$row['useractivestatus'] I can see it always returns the data from the email column, causing the query to always return false and trigger the die response. I can do var_dump$row['<em>any other column</em>'] and it returns the correct data. why is the it returning the email when querying the useractivestatus column?</p>