Re: [SQL] escaping the '

From: engelbert gruber <engelbert(dot)gruber(at)metasys(dot)co(dot)at>
To: Andy Lewis <alewis(at)mpsi(dot)net>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] escaping the '
Date: 1998-05-27 08:37:55
Message-ID: 356BD0E1.CCF80D4F@metasys.co.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Andy Lewis 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.
>

how about String Functions AddSlashes (RTFM)

> As always, thanks in advance!
>

minimum sweat

--
---------------------------------------------
engelbert gruber
METASYS Datentechnik
- innsbruck/austria/europe
email : Engelbert(dot)Gruber(at)metasys(dot)co(dot)at

webpg : http://www.metasys.co.at
---------------------------------------------

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message The Hermit Hacker 1998-05-27 12:03:06 select across two databases
Previous Message Przemyslaw Bak 1998-05-27 06:22:09