Re: populating list menus with mysql and for statements

From: Date: Sun, 09 Jun 2002 13:47:33 +0000
Subject: Re: populating list menus with mysql and for statements
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-101328@lists.php.net to get a copy of this message
seperate your layers. Create a database, display and action layer. For example: include qry_users.inc; include dsp_users.inc; in qry_users.inc get your data and store them into an array var: while($row->user) user[] = $row->user; } Then in dsp_users get them out again: foreach ($user AS $value) echo $value; } Of course you have to built your code around the foreach in dsp_user; Hope this helps Andy -- ---------------------------------------------------- http://www.globosapiens.net Global Travellers Network! "Electroteque" <daniel@electroteque.org> schrieb im Newsbeitrag news:20020609092819.46397.qmail@pb1.pair.com... > hi i am populating a list menu with mysql , i would like to find a way to > populate a form with more than one of the same list menus in a for loop > > <select name="type[]"> > <? > while ($sample = $result->fetchRow(DB_FETCHMODE_ASSOC)) { > $typeID=$sample["typeID"]; > $description=$sample["description"]; > $sample_type[$sample['typeID']] = $sample["description"]; > echo "\n<option value=\"$typeID\" > $selected>$description</option>"; > } > ?> > </select> > > i have this within a for loop but the list only shows up once and the second > one is empty because the select from the database is finished , > > is there a way to put the information from mysql into arrays so i can use it > more than once and then i could do multiple populated list boxes ? let me > know > > > >

« previous php.general (#101328) next »