Re: Populating HTML List boxes From DB

From: Date: Tue, 17 Apr 2001 15:11:22 +0000
Subject: Re: Populating HTML List boxes From DB
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-48981@lists.php.net to get a copy of this message
I had that same problem. Use the "distinct" keyword in your SQL query. -- Plutarck Should be working on something... ...but forgot what it was. ""Peter Houchin"" <peterh@vfsa.com.au> wrote in message news:NFBBJNAGDIPHLCGPBLKDMEFACDAA.peterh@sunrentals.com.au... > One thing I've come across and forgot to mention is > > say in my db i have multiple values that are the same as well as different values... how can i restrict it to showing each value just once? > > -----Original Message----- > From: Alexander Skwar [mailto:ASkwar@digitalprojects.com] > Sent: Tuesday, April 17, 2001 10:17 AM > To: Peter Houchin > Cc: Php-General@Lists. Php. Net > Subject: Re: [PHP] Populating HTML List boxes From DB > > > So sprach Peter Houchin am Tue, Apr 17, 2001 at 10:08:36AM +1000: > > 1: is there a way to populate a list box from a db? > > Sure. > > > > > 2: if some one could point me in the right direction, with out actually giving a example, as to how to go about it as i've > > got no idea > > Uhm, no example? I'll try. ... failed *G* > > <select name="Listbox" size="42"><?php > $query = "SELECT ListboxText, ListboxValue FROM Table"; > $rs = mysql_select( $query ); > while( $row = mysql_fetch_object( $rs ) ){ > echo '<option value="'; > echo htmlentities( $row->ListboxValue ); > echo '">'; > echo htmlentities( $row->ListboxText ); > } > ?></select> > > Alexander Skwar > -- > How to quote: http://learn.to/quote (german) > http://quote.6x.to (english) > Homepage: http://www.digitalprojects.com | > http://www.iso-top.de > iso-top.de - Die günstige Art an Linux Distributionen zu kommen > Uptime: 2 hours 3 minutes >

« previous php.general (#48981) next »