Proper escaping for char(3) string, or PHP at fault, or me at fault?

Started by semi-ambivalentabout 19 years ago4 messagesgeneral
Jump to latest
#1semi-ambivalent
rloefgren@forethought.net

All,

I have a char(3) column that has occasional values of this:
(V)

In a PHP-called nested query I've a line something like:
select * from tableA where = any (select date from tableA where void !
= '(V)') group by date order by record

This is throwing a query error in the log that blames the parens but
my efforts to properly escape them with backslashes or "E" doesn't
help. So perhaps this is an error in my PHP, and I'll deal with that,
but in the SQL portion shouldn't '\(V\)' do the trick? Or is it now
'E(VE)'?

thanks,

r

#2Chris
dmagick@gmail.com
In reply to: semi-ambivalent (#1)
Re: Proper escaping for char(3) string, or PHP at fault, or me at fault?

semi-ambivalent wrote:

All,

I have a char(3) column that has occasional values of this:
(V)

In a PHP-called nested query I've a line something like:
select * from tableA where = any (select date from tableA where void !
= '(V)') group by date order by record

Shouldn't that be

select * from table where FIELD = any (.....)

?

--
Postgresql & php tutorials
http://www.designmagick.com/

#3semi-ambivalent
rloefgren@forethought.net
In reply to: Chris (#2)
Re: Proper escaping for char(3) string, or PHP at fault, or me at fault?

On Wed, 14 Feb 2007, Chris wrote:

semi-ambivalent wrote:

All,

I have a char(3) column that has occasional values of this:
(V)

In a PHP-called nested query I've a line something like:
select * from tableA where = any (select date from tableA where void !
= '(V)') group by date order by record

Shouldn't that be

select * from table where FIELD = any (.....)

?

--
Postgresql & php tutorials
http://www.designmagick.com/

Yes it should be, and I'm hoping I just made a typo in my post, but I've
missed bonehead mistakes like that in the past; it's not forbidden in the
future. I'll check after I take my son to school.

r

#4semi-ambivalent
rloefgren@forethought.net
In reply to: semi-ambivalent (#3)
Re: Proper escaping for char(3) string, or PHP at fault, or me at fault?

On Wed, 14 Feb 2007, rloefgren@forethought.net wrote:

On Wed, 14 Feb 2007, Chris wrote:

semi-ambivalent wrote:

All,

I have a char(3) column that has occasional values of this:
(V)

In a PHP-called nested query I've a line something like:
select * from tableA where = any (select date from tableA where void !
= '(V)') group by date order by record

Shouldn't that be

select * from table where FIELD = any (.....)

?

--
Postgresql & php tutorials
http://www.designmagick.com/

Yes it should be, and I'm hoping I just made a typo in my post, but I've
missed bonehead mistakes like that in the past; it's not forbidden in the
future. I'll check after I take my son to school.

r

Well, I didn't forget a field (thank goodness), but I let a space creep in
in "!=", I had "! =". It was on a linewrap in a window but that's no
excuse to miss it. (sigh)

thx,

r