From: Mariusz Pękala <skoot@qi.pl>
To: pgsql-php@postgresql.org
Subject: Re: ERROR: unterminated quoted string... help
Date: Tue, 17 May 2005 21:17:37 +0200
Message-ID: <20050517191737.GA11375@cthulhu.sdi.tpnet.pl> (raw)
In-Reply-To: <428A34D9.5000700@productivitymedia.com>
References: <DCD4903594CCF34CAFE200BDF3448D8D5B291A@tshuscodenmbx01.ERF.THOMSON.COM>
<20050517170636.GC12405@phlogiston.dyndns.org>
<428A2E81.2060501@pobox.com>
<428A34D9.5000700@productivitymedia.com>
On 2005-05-17 14:15:53 -0400 (Tue, May), Postgres Admin wrote:
> Hi
>
> I'm trying to insert encrypted data into the database and I'm noticing
> error dealing with quotes. Below is the error print out...
>
> suggestions and/or at least point me in the direction to find a solution,
>
> Thanks,
> J
>
> INSERT INTO sample.users (user_name, first_name) VALUES
> ('jokers', '=??iF!?6(Ö????ó???'-Iw?iDÖiJ??? %')
>
> Warning: pg_query() [function.pg-query]: Query failed: ERROR:
> unterminated quoted string at or near "'=??i" at character 68 in
> /usr/local/apache2/htdocs/php/5/Theirry_DB.php on line 162
You should pass the encrypted data thru pg_escape_string() function.
You surely should do it with almost EVERY string that you put as an
argument in a query, especially if it comes from 'outside'.
$query = "INSERT INTO .... ('jokers','" . pg_escape_string($encrypted) . "');" ;
--
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: skoot@qi.pl, pgsql-php@postgresql.org
Subject: Re: ERROR: unterminated quoted string... help
In-Reply-To: <20050517191737.GA11375@cthulhu.sdi.tpnet.pl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox