Received: from [203.3.121.10] (jafar.unixpac.com.au [203.3.121.10]) by postgresql.org (8.11.3/8.11.4) with SMTP id fAG5uXm77366 for ; Fri, 16 Nov 2001 00:56:34 -0500 (EST) (envelope-from peterh@600ml.com.au) Received: from no.name.available by [203.3.121.10] via smtpd (for postgresql.org [64.49.215.8]) with SMTP; 16 Nov 2001 06:01:28 UT Received: from 600mlPeterPC1 (localhost.localdomain [127.0.0.1]) by eeyore.unixpac.com.au (Postfix) with SMTP id CC22A19295; Fri, 16 Nov 2001 16:56:37 +1100 (EST) Message-ID: <009d01c16e62$a0c0e110$0300000a@600mlPeterPC1> Reply-To: "Peter" From: "Peter" To: "Jesus Aneiros" , "PostgreSQL PHP" References: Subject: Re: Wildcard queries via PHP4 Date: Fri, 16 Nov 2001 16:50:42 +1100 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.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200111/107 X-Sequence-Number: 748 yes the easiest way is select * from table where LIKE '%$NAME%' for case sensitive search or select * from table where ILIKE '%$NAME%' if the you want to do a case insensitive search much, much, much faster than regular expression regards, Peter ----- Original Message ----- From: "Jesus Aneiros" To: Cc: Sent: Friday, April 06, 2001 1:28 PM Subject: Re: [PHP] Wildcard queries via PHP4 > You could try LIKE and %, but I think it is ~* and not *~ > > Saludos, Jesus. > > On Thu, 5 Apr 2001, rickf wrote: > > > 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); file://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 > > ________________________________ > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >