Re: Re: Only one value.
| From: | Mark Charette | Date: | Sun, 27 Jan 2002 21:27:10 +0000 |
| Subject: | Re: Re: Only one value. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82319@lists.php.net to get a copy of this message | ||
From: "Michael Kimsal" <michael@tapinternet.com>
> Philip J. Newman wrote:
>
> > Don't know is this is a Mysql problem or PHP, but I have a table with
100 records in it. One of the field names is $iName.
> >
> > When listing all the records I want only the 1st Uneak value to be
displayed.
> >
> > For excample
> >
> > if values where, Bob, Jan, Mike, James, Bob, James, James, Mike ...
> >
> > I would like to call: Bob, Jan, Mike, James ... Any Idenas
> >
>
>
> I suspect you mean the mysql field name is 'iName', not '$iname' ($iName
> being the PHP variable name).
>
> try
>
> select distinct(iName) from tablename
>
> and loop through those result sets.
Almost right. DISTINCT is not a SQL function:
select distinct iName from tablename
would be the correct syntax.