On Wed, May 24, 2006 at 02:28:33PM -0600, Phillip S. Baker wrote: > 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); I'm not sure how this is mysql specific. it appears that this is some class you are using. > > 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. The class you are using probably does some caching of the result so you are able to do this. > > 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"; > } This is sort of expected with any interface, if you want to start over you would probably have a $result->seek() call resetting the result to the beginning of the result set. I dont think pear has such a thing. The pear mailing list might be more helpful. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php