Received: from bush.rutgersinsurance.com (rutgersinsurance.com [38.138.71.194]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f36DLw820418 for ; Fri, 6 Apr 2001 09:21:58 -0400 (EDT) (envelope-from aalang@rutgersinsurance.com) Received: from 6014cwpza006 (adam.rutgersinsurance.com [10.10.10.51]) by bush.rutgersinsurance.com (8.9.3/8.9.3) with SMTP id JAA23815 for ; Fri, 6 Apr 2001 09:35:27 -0400 Message-ID: <003601c0be9c$e55e1de0$330a0a0a@rutgersinsurance.com> From: "Adam Lang" To: References: <5.0.2.1.0.20010405200751.009ed470@127.0.0.1> Subject: Re: Wildcard queries via PHP4 Date: Fri, 6 Apr 2001 09:24:23 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200104/5 X-Sequence-Number: 258 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" To: 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 > ________________________________ > >