X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 142F652807 for ; Tue, 17 May 2005 16:45:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30506-02 for ; Tue, 17 May 2005 19:45:10 +0000 (GMT) Received: from 213.76.235.78 (pb78.olsztyn.sdi.tpnet.pl [213.76.235.78]) by svr1.postgresql.org (Postfix) with ESMTP id 89027528CD for ; Tue, 17 May 2005 16:44:58 -0300 (ADT) Received: (qmail 11461 invoked by uid 1000); 17 May 2005 21:17:37 +0200 Date: Tue, 17 May 2005 21:17:37 +0200 From: Mariusz =?iso-8859-2?Q?P=EAkala?= To: pgsql-php@postgresql.org Subject: Re: ERROR: unterminated quoted string... help Message-ID: <20050517191737.GA11375@cthulhu.sdi.tpnet.pl> Mail-Followup-To: pgsql-php@postgresql.org References: <20050517170636.GC12405@phlogiston.dyndns.org> <428A2E81.2060501@pobox.com> <428A34D9.5000700@productivitymedia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <428A34D9.5000700@productivitymedia.com> User-Agent: Mutt/1.5.8i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.581 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, RCVD_NUMERIC_HELO X-Spam-Level: * X-Archive-Number: 200505/31 X-Sequence-Number: 3145 On 2005-05-17 14:15:53 -0400 (Tue, May), Postgres Admin wrote: > Hi >=20 > I'm trying to insert encrypted data into the database and I'm noticing=20 > error dealing with quotes. Below is the error print out... >=20 > suggestions and/or at least point me in the direction to find a solution, >=20 > Thanks, > J >=20 > INSERT INTO sample.users (user_name, first_name) VALUES=20 > ('jokers', '=3D??=06iF=17!?6(=D6????=F3=7F?=08??'-Iw?iD=D6iJ??? %') >=20 > Warning: pg_query() [function.pg-query]: Query failed: ERROR:=20 > unterminated quoted string at or near "'=3D??=06i" at character 68 in=20 > /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 =3D "INSERT INTO .... ('jokers','" . pg_escape_string($encrypted) .= "');" ; -- bashian roulette:=20 $ ((RANDOM%6)) || rm -rf ~