Excellent. Thanks for everyone's response. I put: mysql_data_seek($result_Section, 0); just ahead of the second while loop and it works perfectly. Thanks again, George > -----Original Message----- > From: Mark Roedel [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 04, 2001 10:52 AM > To: George Wright; [EMAIL PROTECTED] > Subject: RE: [PHP] reusing MySQL results > > > > -----Original Message----- > > From: George Wright [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, April 04, 2001 9:35 AM > > To: '[EMAIL PROTECTED]' > > Subject: [PHP] reusing MySQL results > > > > > > Hi All, > > > > I have a page with two forms. Both forms have drop-down option > > lists that are populated by a the same query. The query and > > db connection are all done before either form is introduced > > (this is the select statement, mysql_pconnect(), mysql_select_db(), > > and mysql_query()). > > > > I am using a while loop to build the options. The loop "engine" > > is mysql_fetch_object(), which writes out the values inside of > > option tags. > > > > Everything works fine the first time around, but when I call > > the query result for the second time, it's as if there are no > > rows to return so nothing is written out. No errors are being > > thrown. > > Mysql_data_seek() is your friend. > > PHP has an internal pointer that it maintains as you move through your > result set. At the end of your mysql_fetch_object while loop, that > pointer is located at the end of the result set. > > Mysql_data_seek() is the means for you to "rewind" that pointer to the > any specified row, including the first, of the result set. > > See > > http://php.net/manual/en/function.mysql-data-seek.php > > for more information, including sample code. > > > --- > Mark Roedel ([EMAIL PROTECTED]) || "There cannot be a crisis > next week. > Systems Programmer / WebMaster || My schedule is already full." > LeTourneau University || -- > Henry Kissinger > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]