Re: ERROR: unterminated quoted string... help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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 ~


[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux