Re: ERROR: unterminated quoted string... help - Mailing list pgsql-php

From Mariusz Pękala
Subject Re: ERROR: unterminated quoted string... help
Date
Msg-id 20050517191737.GA11375@cthulhu.sdi.tpnet.pl
Whole thread Raw
In response to ERROR: unterminated quoted string... help  (Postgres Admin <postgres@productivitymedia.com>)
List pgsql-php
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 ~

pgsql-php by date:

Previous
From: Postgres Admin
Date:
Subject: Re: [SQL] ERROR: unterminated quoted string... help
Next
From: Volkan YAZICI
Date:
Subject: Re: ERROR: unterminated quoted string... help