I have a result set that I am retrieving from a large database:
$result = mysql_query($sql);
I scroll through this recordset once to pull out certain bits of data and get average values โโusing while($row = mysql_fetch_array($result)) . Later on the page, I want to skip the same recordset again and print everything, but since I used the recordset before, my second loop returns nothing.
I finally cracked this by going over the second identical set of records ( $result2 = mysql_query($sql); ), but I don't like to make the same SQL call twice. In any case, can I iterate over the same data set several times?
php mysql
MarathonStudios
source share