From: | "Luis H" <pgsql-php(at)geekhouse(dot)no-ip(dot)com> |
---|---|
To: | <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: Case sensitivity when searching for and displaying data |
Date: | 2003-09-04 02:40:05 |
Message-ID: | 005001c3728d$d979a8d0$0000fea9@bigbertha |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
----- Original Message -----
From: "Lynna Landstreet" <lynna(at)gallery44(dot)org>
To: <pgsql-php(at)postgresql(dot)org>
Sent: Wednesday, September 03, 2003 6:31 PM
Subject: [PHP] Case sensitivity when searching for and displaying data
> Hello,
>
> I've gotten a simple PHP search page working on the artists database that
----- Original Message -----
From: "Lynna Landstreet" <lynna(at)gallery44(dot)org>
To: <pgsql-php(at)postgresql(dot)org>
Sent: Wednesday, September 03, 2003 6:31 PM
Subject: [PHP] Case sensitivity when searching for and displaying data
> Ideally I'd like the search text to case insensitive, so that if the user
> enters "jane smith", "Jane Smith" or "JANE SMITH", they'll still find the
> record for Jane Smith. But I'm not sure how to do that.
For the searching, I'd read through the pattern matching section of pgsql
doc:
http://www.postgresql.org/docs/7.3/static/functions-matching.html
For simple searches, ILIKE performs a case-insensitive search, and for
Regular Expressions, use ~* instead of ~.
> Secondly, the case sensitivity thing is also messing up the order of the
> displayed results. Right now I have them set to order by lastname, and
that
> makes any names that begin with a lower case character come at the end of
> the list because of the order of the ASCII values of the letters, rather
> than where they would normally be in alphabetical order. Does anyone know
if
> there's a way around this?
In terms of sorting, you could use the function lower(string), which
converts text to lowercase, or upper(string).
So you'd execute a query:
select * from table ORDER BY lower(lastname);
>
>
> Thanks,
>
> Lynna
> --
No prob. :)
Luis
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Kings-Lynne | 2003-09-04 06:17:12 | Re: Case sensitivity when searching for and displaying data |
Previous Message | Robby Russell | 2003-09-03 23:20:34 | Re: Case sensitivity when searching for and displaying data |