title: Resetting array pointer in PDO results
body: <p>I'm having trouble moving from MySQL SELECT methods to PDO methods. I want to iterate through a fetched array twice, both times starting with row zero. In MySQL I would use:</p>
  
  <pre><code>mysql_data_seek($result,0);
  </code></pre>
  
  <p>Using PDO methods, I'm not sure how to accomplish the same thing. The code below is how I am trying to do this. The first while loop works fine but the second while loop returns nothing.</p>
  
  <pre><code>$pdo = new PDO('mysql:host=' . $host . ';dbname='.$database, $username, $password);
  $pdo-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
  $stmt = $pdo-&gt;prepare('SELECT * FROM mytable WHERE active = 1 ORDER BY name ASC');
  $stmt-&gt;setFetchMode(PDO::FETCH_ASSOC);
  $stmt-&gt;execute();
  
  while($row = $stmt-&gt;fetch())
  {
      //do something starting with row[0]
  }
  while($row = $stmt-&gt;fetch())
  {
      //do something else starting with row[0]
  }
  </code></pre>