Re: Case insesnitive searches with postgres

From: Date: Thu, 21 Sep 2000 01:09:04 +0000
Subject: Re: Case insesnitive searches with postgres
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-3020@lists.php.net to get a copy of this message
I tried your suggestion and I get the following error: Warning: PostgresSQL query failed: ERROR: regcomp failed with error empty (sub)expression in /home/kerry/homepage/secondchance.php/list.php on line 45 An error occurred. Would escaping like \"~*\" solve this issue or am I missing something? Thanks once again. Kerry On Thu, Sep 21, 2000 at 10:49:35AM +1100 or thereabouts, john slee wrote: > On Wed, Sep 20, 2000 at 06:35:18PM -0400, kerry@noc.suntrix.com wrote: > > I've tried for about a week to get the "~*" identifier to work with > > postgres to do a case insensitive search and haven't gotten it to > > work. Here's the query I'm trying to select: > > > > $result = pg_Exec( $conn, "SELECT DISTINCT author,title,price FROM > > books where author like '%".$Author."%' or title like > > '%".$Title."%'") ; > > ~* is a regexp compare, which is very different from 'like'. > > you want something like > > pg_exec($conn, "SELECT DISTINCT author,title,price FROM books > WHERE author ~* '$author' OR title ~* '$title'"); > > if you put % in, the regexp engine will look for it in the text, which i > don't think is what you want :) > > j. > > -- > .----------+---------------------------------. > |John Slee `-------. <indigoid@chirp.com.au>| > |Chirp Web Design | http://www.chirp.com.au| > |Phone 02 62301871 `--------. 02 62301515 Fax| > `---------------------------+----------------' > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#3020) next »