Re: Case insesnitive searches with postgres

From: Date: Thu, 21 Sep 2000 02:49:28 +0000
Subject: Re: Case insesnitive searches with postgres
References: 1 2 3 4  Groups: php.db 
Request: Send a blank email to php-db+get-3021@lists.php.net to get a copy of this message
On Wed, Sep 20, 2000 at 09:09:04PM -0400, kerry@noc.suntrix.com wrote: > 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? strange. possibly $author or $title is empty - check if it is, and if so don't insert the revelvant sql. something like this, perhaps: $sql = "SELECT title,author FROM books WHERE true"; if ($title != "") $sql .= " AND title ~* '$title'"; if ($author != "") $sql .= " AND author ~* '$author'"; $result = pg_exec($conn,$sql); (the 'WHERE true' is just to make generating the sql less painful, and has no effect on the result) if this is indeed the problem, i'd report it as a bug to the postgresql developers, it looks like an annoying thing to have to cope with. i don't believe i've ever seen that error with psql 6.5.x though, what version are you using? j. -- .----------+---------------------------------. |John Slee `-------. <indigoid@chirp.com.au>| |Chirp Web Design | http://www.chirp.com.au| |Phone 02 62301871 `--------. 02 62301515 Fax| `---------------------------+----------------'

« previous php.db (#3021) next »