title: PDO returning execute results to an array
body: <p>So I am bashing my head against the wall over a question which more than likely has a simple solution. Here is my code.</p>
  
  <pre><code>public function login($username, $password){
  
          $sql = "SELECT * FROM users WHERE username = :user AND password = :pass";
          $stmt = $this-&gt;pdo-&gt;prepare($sql);
          $data = array('user' =&gt; $username, 'pass' =&gt; md5($password . $this-&gt;salt));
          $stmt-&gt;execute($data);
  
          $status = $stmt-&gt;fetchColumn();
          if($status){
              echo "You are Logged in!";
              print_r($result);
          } else {
              echo $status;
              $this-&gt;error['alert'] = "You have not entered the correct login information.";
              Users::ErrorReport();
          }
  
      }
  </code></pre>
  
  <p>What I want to do is pull all of the data from that users row and store it in an array so that I can access it in order to store it to the class variables. I would like to do something similar to </p>
  
  <pre><code>while($row = $stmt-&gt;fetchAll()){
     $this-&gt;username = $row['username'];
  }
  </code></pre>
  
  <p>The problem when I do this is Ive run into a million nasty errors and cant find any solutions while searching the net.</p>