Looping through a Db query result twice in PEAR

From: Date: Wed, 24 May 2006 20:28:33 +0000
Subject: Looping through a Db query result twice in PEAR
Groups: php.general 
Request: Send a blank email to php-general+get-236849@lists.php.net to get a copy of this message
Greetings All, I have a problem that I usually solve in MySQL pretty easily, but using PEAR identifiers are not working. Any suggestions. I want to loop through a result set in two different while loops that are not nested. I am able to do in it MySQl as follows $sql="Some query"; $result = $conn->query($sql); while ($row = $result->fetchArray()) { echo $row['hey']; } while ($row2 = $result->fetchArray()) { echo $row2['otherhey']; } This has worked in the past and I do not have to hit up the DB twice for the same information. However when I try something similar with PEAR it does not work. So the below does not work. This is my first time using PEAR. So can anyone help me out. I cannot seem to find anything about this on the documentation online. $sql="Some query"; $result = $db->query($sql); while($result->fetchInto($data)) { echo "\t\t\t<li><a href=\"#$data[id]\">$data[question]</a></li>\n"; } while($result->fetchInto($data2)) { echo "<a name=\"#$data2[id]\">$data2[answer]</a></li>\n"; } Thanks Phillip

« previous php.general (#236849) next »