title: Can you reuse a mysql result set in PHP?
body: <p>I have a result set I pull from a large database:</p>
  
  <pre><code>$result = mysql_query($sql);
  </code></pre>
  
  <p>I loop through this recordset once to pull specific bits of data and get averages using <code>while($row = mysql_fetch_array($result))</code>. Later in the page, I want to loop through this same recordset again and output everything - but because I used the recordset earlier, my second loop returns nothing. </p>
  
  <p>I finally hacked around this by looping through a second identical recordset (<code>$result2 = mysql_query($sql);</code>), but I hate to make the same SQL call twice. Any way I can loop through the same dataset multiple times?</p>