note 92294 modified in function.pg-escape-bytea by danbrown
| From: | danbrown@php.net | Date: | Fri, 17 Jul 2009 21:35:12 +0000 |
| Subject: | note 92294 modified in function.pg-escape-bytea by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158439@lists.php.net to get a copy of this message | ||
If you're getting errors about nonstandard use of \\ in a string literal, then you need to
escape the encoded bytea as follows:
<?php
$escaped = pg_escape_bytea($data);
pg_query("INSERT INTO gallery (name, data) VALUES ('Pine trees',
E'$escaped'::bytea)");
?>
--was--
If you're getting errors about nonstandard use of \\ in a string literal, then you need to
escape the encoded bytea as follows:
$escaped = pg_escape_bytea($data);
pg_query("INSERT INTO gallery (name, data) VALUES ('Pine trees',
E'$escaped'::bytea)");
http://php.net/manual/en/function.pg-escape-bytea.php