title: How do I reset a PHP pointer for a MySQL resource?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3817997/how-to-reset-mysql-pointer-back-to-the-first-row-in-php">How to reset mysql pointer back to the first row in PHP?</a>  </p>
  </blockquote>
  
  
  
  <p>I have 2 while loops in my PHP script that processes a list of data from a database.</p>
  
  <pre><code>$results = mysql_query("SELECT * FROM myTable");
  while ($result = mysql_fetch_object($results))  {
      // do stuff
  }
  
  reset($results);
  while ($result = mysql_fetch_object($results))  {
      // do some more stuff
  }
  </code></pre>
  
  <p>However, the reset() function is not resetting my pointer within the MySQL resource. In fact, it generates an error:</p>
  
  <blockquote>
    <p>"Warning: reset() [function.reset]: Passed variable is not an array or
    object in  /home/cs179_team13/public_html/timeTests/results.php on
    line 133."</p>
  </blockquote>
  
  <p>Why? How do I reset a PHP pointer for a MySQL resource?</p>