Re: ERROR: unterminated quoted string... help

From: Mariusz Pękala <skoot(at)qi(dot)pl>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: ERROR: unterminated quoted string... help
Date: 2005-05-17 19:17:37
Message-ID: 20050517191737.GA11375@cthulhu.sdi.tpnet.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php pgsql-sql

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 ~

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Andrew Sullivan 2005-05-17 20:11:38 Re: Does Postgresql have a similar pseudo-column "ROWNUM" as
Previous Message Alain 2005-05-17 18:43:32 Re: Does Postgresql have a similar pseudo-column "ROWNUM" as

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2005-05-17 20:11:38 Re: Does Postgresql have a similar pseudo-column "ROWNUM" as
Previous Message Alain 2005-05-17 18:43:32 Re: Does Postgresql have a similar pseudo-column "ROWNUM" as