title: What is the exact equivalent of mysqli_fetch_array function in PDO?
body: <p>Since i've changed to PDO, i really can't seem to get the right function to use that would do exactly what mysqli_fetch_array() was doing, this happens probably because i don't realy understand the real diffrence between mysqli_fetch_array and PDO's fecth().</p>
  
  <p>From some sources, while($row = mysqli_fetch_array($query) "fetches a single row from the resultset each time it is called.", whereas $row = $query->fetch() is returning the whole resultset in one single call. </p>
  
  <p>I've asked two similar questions and one with a bounty but i can't seem to get a proper way around what i want to do. </p>
  
  <p>, <a href="https://stackoverflow.com/questions/23575895/translation-mysql-fetch-array-to-pdofetch-num">From this question</a>, </p>
  
  <ul>
  <li>mysql_fetch_array = fetch(PDO::FETCH_BOTH) - The rows are arrays with both numeric and   named indexes.</li>
  <li>mysql_fetch_assoc = fetch(PDO::FETCH_ASSOC) - The rows are arrays with named indexes.</li>
  <li>mysql_fetch_row = fetch(PDO::FETCH_NUM) - The rows are arrays with numeric indexes.</li>
  <li>mysql_fetch_object = fetch(PDO::FETCH_OBJ) or fetch(PDO::FETCH_CLASS) depending on whether you specify the optional className argument to mysql_fetch_object. The rows are objects, either of the specified class or stdClass.</li>
  <li>The while loop is equivalent to:</li>
  </ul>
  
  <p>$data = $query->fetchAll(PDO::FETCH_BOTH), </p>
  
  <p>Using the first on this list just seems to behave differently from what mysqli_fetch_arrray does.</p>
  
  <p>What i've tried returns so many errors in the while loop and crushes the browser at times, thanks to Chrome, i won't post that.</p>
  
  <p><strong>HERE's what i want to do</strong>.</p>
  
  <pre><code>$counter = 0;    
  while($row = mysqli_fetch_array($query)){
     $counter++;
      echo $counter;
      echo $row['Name'];
  }
  </code></pre>
  
  <p>If we have three rows: <strong>RESULT</strong>;</p>
  
  <pre><code>1
  TRIQUESHA
  
  2
  STACEY
  
  3
  DAQUEN
  </code></pre>
  
  <p><strong>NOW PDO</strong></p>
  
  <pre><code>$count = 0;
  while($row = $query-&gt;fetch(PDO::FETCH_BOTH)){
  $counter++;
      echo $counter;
      echo $row['Name'];
  }
  </code></pre>
  
  <p>Again if we have three rows: <strong>PDO RESULT</strong>;</p>
  
  <pre><code>3
  TRIQUESHA
  
  3
  STACEY
  
  3
  DAQUEN
  </code></pre>
  
  <p>It's not counting, its returning the total number of rows instead, if i had 50 rows, it would repeat 50 on each row.</p>
  
  <p>What am I doing wrong?</p>