title: PDO: Multi. Row and Column - How to loop through array?
body: <p>This is my array:</p>
  
  <p><img src="https://i.imgur.com/WENQmxm.png" alt=""></p>
  
  <p>When I used mysqli_query in a <em>different</em> script, this style worked:</p>
  
  <pre><code>while ($printTest = mysqli_fetch_array($results)) {
      echo $printTest['id'] . "&lt;br /&gt;"; 
      echo $printTest['questions'] . "&lt;br /&gt;";
      echo $printTest['answers'] . "&lt;br /&gt;";
  }
  </code></pre>
  
  <p>I can't figure out how to do the same thing with a PDO created array. With PDO, I can use foreach, like this:</p>
  
  <pre><code>foreach ($queryRows as $test=&gt;questions){
      echo $test; 
  }
  </code></pre>
  
  <p>Unfortunately, that doesn't give me access to <code>id</code> and <code>answers</code> in the same loop - which is important to me. </p>
  
  <p>This is how I'm getting my PDO-generated array, currently: </p>
  
  <pre><code>$queryRows = $this-&gt;dbh-&gt;query("SELECT id, questions, answers FROM qarows WHERE usr = '$this-&gt;username'");
  $queryRows = $queryRows-&gt;fetchAll(PDO::FETCH_ASSOC);
  </code></pre>
  
  <p>How do I access all 3 columns of my array, in a loop?</p>