Re: help - WHILE in FOREACH

From: Date: Wed, 08 Jan 2003 02:09:01 +0000
Subject: Re: help - WHILE in FOREACH
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-130678@lists.php.net to get a copy of this message
> From: "James Brennan" <loopjunkie@hotmail.com> > Sent: Tuesday, January 07, 2003 8:29 PM > Subject: [PHP] help - WHILE in FOREACH > The while statement is only executing correctly for the first run through > the foreach loop. Why? > > Thanks, > loop > > foreach($desc as $key=>$value) { > printf("Show %s Description <select name='show%sDesc'>", $key, $key); > echo "<option value = ''></option>"; > > while($row = mysql_fetch_row($show_names)) { > printf("<option value='%s'>%s</option>", $row[0], $row[1]); > } > echo "</select><br>"; > } You didn't really explain the problem well, but I think this is what you're looking for http://www.php.net/manual/en/function.mysql-data-seek.php Reset the pointer before the while loop and the names should list of all of the select boxes.

« previous php.general (#130678) next »