RE: [PHP] Re: A stupid question...
| From: | Niklas Lampén | Date: | Mon, 11 Mar 2002 10:02:20 +0000 |
| Subject: | RE: [PHP] Re: A stupid question... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87980@lists.php.net to get a copy of this message | ||
An option too:
SELECT * FROM table WHERE SURNAME LIKE 'a%' ORDER BY surname ASC
Niklas
-----Original Message-----
From: liljim [mailto:liljim@liljim.co.uk]
Sent: 11. maaliskuuta 2002 11:09
To: php-general@lists.php.net
Subject: Re: [PHP] Re: A stupid question...
Hi chuck,
use left()
assuming your column is called "name", then something like this will do:
$letter = "a";
$get = @mysql_query("SELECT * FROM table WHERE LEFT(surname, 1) =
'$letter' ORDER BY surname ASC");
That should get out all of the fields beginning with a or A and list
them alphabetically.
Hope that's of some help.
James
"Chuck "Pup" Payne" <cepayne@magidesign.com> wrote in message
news:B8B188BB.C826%cepayne@magidesign.com...
> I want to sort by a letter in a colomn. Let say I want to sort the
> colomn last_name. I can do order by but I can do just the A's.
>
> http://www.myserver.com/mysort.php?Letter=A
>
> Like to create a link on a web "A" then sort only the last name are A.
>
> I hope that's helps. I can order by, but I can't so a sort like the
example
> above.
>
> Chuck Payne
> Magi Design and Support
>
>
> > on 3/10/02 9:42 PM, Cary at cary@Ali-Co.com wrote:
> >
> >> At 08:24 PM 3/10/02, Chuck \"PUP\" Payne wrote:
> >>> Hi,
> >>>
> >>> I not a newie but I am not a pro at mysql either. I want to do a
> >>> query
by
> >>> letter(a, b, c..ect.). Is there a simple way to do it. I am
> >>> writing in
PHP.
> >>> So can someone please so me the how.
> >>
> >>
> >> I'm not totally sure what your looking for. If you could elaborate
> >> a
little
> >> I am sure that one of us could help you out.
> >>
> >> Cary
> >>
> >>
> >>
> >
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php