pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adam Lang <aalang@rutgersinsurance.com>
To: pgsql-php@postgresql.org
Subject: Re: Wildcard queries via PHP4
Date: Fri, 6 Apr 2001 09:24:23 -0400
Message-ID: <003601c0be9c$e55e1de0$330a0a0a@rutgersinsurance.com> (raw)
References: <5.0.2.1.0.20010405200751.009ed470@127.0.0.1>

Use LIKE, as others have mentioned.  The reason the wildcard doesn't work is
because it isn't supposed to.  No SQL should use it.

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "rickf" <rickf@dufferinresearch.com>
To: <pgsql-php@postgresql.org>
Sent: Thursday, April 05, 2001 8:17 PM
Subject: [PHP] Wildcard queries via PHP4


> Hi,
>
> I am trying to find the syntax to pass a wildcard query through to
postgres.
> Basically I just want to use the user input as a substring of the actual
> query to postgres.
> It can even be simpler, I realy only need the wildcard at end of the input
> string
>
> i.e. user inputs Smith in form, I want to pick up Smith & Smithsonian.
>
> Right now I have:
>
> if ( strlen($NAME) >0):
>          $NAME = addslashes($NAME);
>          $NAME = strtolower($NAME);   /
>          $NAME = ucfirst($NAME);   //translation final to Upper 1st letter
> rest lower as per db format.
>
> $conn = pg_Connect("dbname=damn_db port=5432");
> if(!$conn) { echo "Error in connecting to DB\n"; exit;  }
>          $result = pg_Exec($conn, "SELECT * FROM table2 WHERE surname =
> '$NAME' ");
> For whatever reason the *~ matching does not work in PHP4 (ie surname *~ )
> (or more precisely I can't get it to work)
>
> Any suggestions?
>
> Many thanks.
>
>
>
>
>
> _______________________________
> Rick Frank
> Dufferin Research
>
> mailto:rickf@dufferinresearch.com
> ________________________________
>
>




view thread (7+ messages)  latest in thread

Message-ID: <003601c0be9c$e55e1de0$330a0a0a@rutgersinsurance.com>
Permalink:  ../003601c0be9c$e55e1de0$330a0a0a@rutgersinsurance.com/
Also on:    postgresql.org/message-id/003601c0be9c$e55e1de0$330a0a0a@rutgersinsurance.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: aalang@rutgersinsurance.com
  Subject: Re: Wildcard queries via PHP4
  In-Reply-To: <003601c0be9c$e55e1de0$330a0a0a@rutgersinsurance.com>
  References: <5.0.2.1.0.20010405200751.009ed470@127.0.0.1> <003601c0be9c$e55e1de0$330a0a0a@rutgersinsurance.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox