| От | Bruno Wolff III |
|---|---|
| Тема | Re: search/select case-insensitivly. |
| Дата | |
| Msg-id | 20021022114628.GA28016@wolff.to обсуждение |
| Ответ на | search/select case-insensitivly. ("Zhidian Du" <duzhidian@hotmail.com>) |
| Список | pgsql-php |
On Mon, Oct 21, 2002 at 22:01:19 -0600,
Zhidian Du <duzhidian@hotmail.com> wrote:
> I want a PHP program to search case-insensitivly.
>
> for example:
> select Name from mytable where Name = '$Name';
>
>
> Here $Name is what users' input maybe JOHN, john. How to let it match John
> in table and find that record?
As mentioned in other replies you can use the lower or upper functions
to get consistant case.
If you want case preerved in the table, you can make the searches faster
(at the expense of slowing down updates) by creating an index using a function.
Something like:
create index on table mytable(lower(Name));
Will speed up searches like:
select Name from mytable where lower(Name) = lower('$Name');
В списке pgsql-php по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера