Received: from [128.27.0.226] (mail.dufferinresearch.com [216.58.99.248]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f360KL812611 for ; Thu, 5 Apr 2001 20:20:21 -0400 (EDT) (envelope-from rickf@dufferinresearch.com) Received: from RICK.DUFFERINRESEARCH.COM by 128.27.0.226 with SMTP (QuickMail Pro Server for MacOS 1.1.2); 05-Apr-2001 20:20:01 -0400 Message-Id: <5.0.2.1.0.20010405200751.009ed470@127.0.0.1> X-Sender: rickf/128.27.0.226@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.0.2 Date: Thu, 05 Apr 2001 20:17:56 -0400 To: pgsql-php@postgresql.org From: rickf Subject: Wildcard queries via PHP4 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====================_49029387==_.ALT" X-Archive-Number: 200104/2 X-Sequence-Number: 255 --=====================_49029387==_.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed 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 ________________________________ --=====================_49029387==_.ALT Content-Type: text/html; charset="us-ascii" 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
________________________________

--=====================_49029387==_.ALT--