Re: [GENERAL] ' syntax - Mailing list pgsql-general

From Brett W. McCoy
Subject Re: [GENERAL] ' syntax
Date
Msg-id Pine.BSI.3.91.990601150105.25048G-100000@access1.lan2wan.com
Whole thread Raw
In response to ' syntax  (amarof <amarof@marwan.ac.ma>)
List pgsql-general
On Sat, 5 Jun 1999, amarof wrote:

> i got your answers about the syntax, it works with the strings, but when
> etat takes a variable value, it gives a parser error. example : select *
> from table where field like $txt
> the error occurs when txt takes the value (doctortat d'etat).

Is this in Perl or PHP3?  You should be doing it like:

"select * from table where field like '$txt';"

It's especially important that your query string be delimited by double
quotes in Perl, or it won't interpolate your variable.  If unsure, use
the generic quote facility:

qw(select * from table where field like '$txt';)

where the parentheses are functioning as quote characters.

Brett W. McCoy
                                         http://www.lan2wan.com/~bmccoy
-----------------------------------------------------------------------
It's not enough to be Hungarian; you must have talent too.
        -- Alexander Korda


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] Data recovery
Next
From: amarof
Date:
Subject: ' syntax (using PHP3)