The overall concept of what I'm doing is querying a database for two datasets and looping through the results multiple times to build an html table. Sounds simple enough.
My problem though is that I only get the results from the first loop iteration in building my columns of the html table. I have a while loop within a while loop. Below is a simplified version of the nested while loop.
Here's a snippet of code:
$query = mysql_query('some query');
while ($row = mysql_fetch_array($query)){
// read the current mysql row and do some stuff
}
Of course nearly everyone is familiar with what's going on above. But when the loop breaks, I want to somehow reset that mysql_fetch_array so that I can read it again without having to re-run the query. However, reset() does not work. How can I reset it, or move the pointer back to the beginning?
Thanks,
Mark