select LIKE

From: Kevin Heflin <kheflin(at)shreve(dot)net>
To: "PGSQL-General (E-mail)" <pgsql-general(at)postgreSQL(dot)org>
Subject: select LIKE
Date: 1998-09-03 22:21:02
Message-ID: Pine.LNX.4.02.9809031713540.24099-100000@mercury.shreve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(at)shreve(dot)net | Shreveport, LA 71101 | http://www.shreve.net
--------------------------------------------------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Hartwig 1998-09-03 23:53:37 Re: [GENERAL] select LIKE
Previous Message Richard Ryan 1998-09-03 18:28:33 Questions about year 2000 compliance and support