From: | "Anton Stckl" <tony(at)cys(dot)de> |
---|---|
To: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] escaping the ' |
Date: | 1998-05-25 10:09:42 |
Message-ID: | 35694366.A0F50010@cys.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Eric McKeown wrote:
> > I am running Postgres 6.3.2 / PHP 3.0 on Linux 2.0.30.
> >
> > I have a table that has 16 text fields in it. I have a PHP form that allows a
> > user to enter info into that field. When a user enters an ' as in " item's " the
> > query will fail. I have played around with it and can execute the query without
> > error if I escape the ' . Such as " item\'s "
> >
> > Here's the big question:
> >
> > Is there anyway other than doing a ereg_replace(); in PHP to get around this
> > problem? If I do a ereg_replace("'", "\'", $f1) in the PHP file and execute it,
> > I have no problem. I dont recall having this problem in the earlier version of
> > Postgres.
>
> If you're using a php3.ini file, check out the value of "magic_quotes_gpc"
> in that file. If set to 1, that should escape such quotes automatically
> when using GET or POST to send the contents of your form to a processing
> script. If you're not using a php3.ini file (assuming you're running the
> Apache module version), you can use the php3_magic_quotes_gpc directive in
> *.conf or .htaccess. Run httpd -h for details on all the various php
> directives available...
Or you can alway escape the ' by another single quote -> select .. where
value = 'item''s' ..
-Tony
--
----------C-Y-B-E-R-S-O-L-U-T-I-O-N-S----------------
Anton Stöckl mailto:tony(at)cys(dot)de
CyberSolutions GmbH http://www.cys.de
Frankfurter Ring 193A Phone +49 89 32369223
80807 Muenchen Fax +49 89 32369220
------W-E----M-A-K-E----I-T----P-O-S-S-I-B-L-E-------
From | Date | Subject | |
---|---|---|---|
Next Message | Jose' Soares Da Silva | 1998-05-25 11:14:04 | Re: [SQL] decimal(x,y) function. |
Previous Message | Jonah Kuo | 1998-05-25 10:01:39 | Re: [SQL] decimal(x,y) function. |