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"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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:[EMAIL PROTECTED]]
> 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
>



-- 
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]

Reply via email to