ss1289
03-31-2008, 12:05 PM
I want to loop through the results of a query twice. So since fetch_assoc has a counter that points to the next value after each pass in the loop I was wondering if there is a php sql function to restart the fetch_assoc counter to the beginning and do another loop with the same query results. I don't want to have to pull the same results using query() twice.
For example:
res = pg_query($query);
while($row = pg_fetch_assoc($res)){
//get info and do something
}
while($row = pg_fetch_assoc($res)){
//get info and do something different
}
For example:
res = pg_query($query);
while($row = pg_fetch_assoc($res)){
//get info and do something
}
while($row = pg_fetch_assoc($res)){
//get info and do something different
}