Re: select exact term

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Tom, I just discovered that. I reworked the php so the quotes surround the regexp.

-----Original Message-----
From: Tom Lane [mailto:tgl@xxxxxxxxxxxxx] 
Sent: Thursday, March 28, 2013 1:07 PM
To: Marc Fromm
Cc: Craig James; pgsql-admin@xxxxxxxxxxxxxx
Subject: Re:  select exact term

Marc Fromm <Marc.Fromm@xxxxxxx> writes:
> I am struggling with the syntax. In php I create my where clause as shown, using ~* for case insensitive:
> $search = "art";
> $strSQL2 = "WHERE (title ~* [[:<:]]'$search'[[:>:]] OR description ~* 
> [[:<:]]'$search'[[:>:]]) ";

> When executed zero records are returned even though the ILIKE statement shown below returns records that do have the word art.

Your php app must not be bothering to check for errors :-( ... that's invalid SQL syntax.  The bracket constructs are part of the regexp string and need to be inside the single quotes.

			regards, tom lane



-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux