select LIKE - Mailing list pgsql-general

From Kevin Heflin
Subject select LIKE
Date
Msg-id Pine.LNX.4.02.9809031713540.24099-100000@mercury.shreve.net
Whole thread Raw
List pgsql-general
I have a rolodex database in Postgres.
I want allow searches by "name" and/or company from a web page.
I'm using PHP/Apache to connect with postgres

I tried something like:

select * from rolodex where name LIKE '%$name%'

First question: is there a way to do this that is NOT case sensitive?

also I wanted to allow for searches of name and/or company..

but if a user enters info in "name" and not "company" it returns back no
items found.

I'm using '%$company%' (percent signs on both sides so that the user can
take a short guess. However if the user doesn't input anything for
company, this returns no items.. if I have the variable set up as:

'%$company' with only the percent sign in the beginning, it will work o.k.

Any suggestions would be appreciated.

Kevin




--------------------------------------------------------------------
Kevin Heflin          | ShreveNet, Inc.      | Ph:318.222.2638 x103
VP/Mac Tech           | 333 Texas St #619    | FAX:318.221.6612
kheflin@shreve.net    | Shreveport, LA 71101 | http://www.shreve.net
--------------------------------------------------------------------


pgsql-general by date:

Previous
From: "Richard Ryan"
Date:
Subject: Questions about year 2000 compliance and support
Next
From: David Hartwig
Date:
Subject: Re: [GENERAL] select LIKE