ERROR: unterminated quoted string... help
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', '=3D=EF=B5=06iF=17!=B66(=D6=9F=E3=8D=BE=F3=7F=88=08=CC=91'-I w=89=
iD=D6iJ=D0=FF=86 %')
Warning: pg_query() [function.pg-query]: Query failed: ERROR:
unterminated quoted string at or near "'=3D=EF=B5=06i" at character 68 in=
/usr/local/apache2/htdocs/php/5/Theirry_DB.php on line 162
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo [at] postgresql.org so that your
message can get through to the mailing list cleanly
Re: ERROR: unterminated quoted string... help
Scott Marlowe wrote:
>
>Use a bytea field and use pg_escape_bytea() to prepare the data for
>insertion.
>
>
>
Thanks Scott, I will try it now.
J
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo [at] postgresql.org so that your
message can get through to the mailing list cleanly
Re: ERROR: unterminated quoted string... help
On Tue, 2005-05-17 at 13:15, 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', '=3D=C3=AF=C2=B5=06iF=17!=C2=B66(=C3=96=C5=B8=C3=A3=C2=BE=C3 =
=B3=7F=CB=86=08=C3=8C=E2=80=98'-Iw=E2=80=B0iD=C3=96iJ=C3=90= C3=BF=E2=80=A0 =
%')
>
> Warning: pg_query() [function.pg-query]: Query failed: ERROR:
> unterminated quoted string at or near "'=3D=C3=AF=C2=B5=06i" at character=
68 in
> /usr/local/apache2/htdocs/php/5/Theirry_DB.php on line 162
Use a bytea field and use pg_escape_bytea() to prepare the data for
insertion.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
Re: ERROR: unterminated quoted string... help
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', '=3D??=06iF=17!?6(=D6????=F3=7F?=08??'-Iw?iD=D6iJ??? %')
>
> Warning: pg_query() [function.pg-query]: Query failed: ERROR:
> unterminated quoted string at or near "'=3D??=06i" 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 =3D "INSERT INTO .... ('jokers','" . pg_escape_string($encrypted) .=
"');" ;
--
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo [at] postgresql.org)
Re: ERROR: unterminated quoted string... help
SGksCgpPbiA1LzE3LzA1LCBQb3N0Z3JlcyBBZG1pbiA8cG9zdGdyZXNAcHJv
ZHVjdGl2aXR5bWVkaWEuY29tPiB3cm90ZToKPiBJJ20gdHJ5aW5nIHRvIGlu
c2VydCBlbmNyeXB0ZWQgZGF0YSBpbnRvIHRoZSBkYXRhYmFzZSBhbmQgSSdt
IG5vdGljaW5nCj4gZXJyb3IgZGVhbGluZyB3aXRoIHF1b3Rlcy4gQmVsb3cg
aXMgdGhlIGVycm9yIHByaW50IG91dC4uLgo+Cj4gc3VnZ2VzdGlvbnMgYW5k
L29yIGF0IGxlYXN0IHBvaW50IG1lIGluIHRoZSBkaXJlY3Rpb24gdG8gZmlu
ZCBhIHNvbHV0aW9uLAo+Cj4gSU5TRVJUIElOVE8gc2FtcGxlLnVzZXJzICh1
c2V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