select LIKE

Kevin Heflin <kheflin@shreve.net>

From: Kevin Heflin <kheflin@shreve.net>
To: "PGSQL-General (E-mail)" <pgsql-general@postgreSQL.org>
Date: 1998-09-03T22:21:02Z
Lists: 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
--------------------------------------------------------------------