Re: Strange pg_escape_string behavior
| From: | Curt Zirzow | Date: | Tue, 08 Nov 2005 02:37:04 +0000 |
| Subject: | Re: Strange pg_escape_string behavior | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-225266@lists.php.net to get a copy of this message | ||
* -k. wrote:
> ...
> pg_exec(): Query failed: ERROR: invalid regular expression: invalid escape \ sequence .
>
> It seems to happen when using just a "\" or text ending with a "\" but not
> if a "\" is in the
> middle of a string of text.
I would guess you have magic_quote_gpc on, you can check this:
var_dump(get_magic_quotes_gpc());
> ...
> $user_item = pg_escape_string($_POST['user_item']);
>
> $dbconn = pg_connect('some connection string that works');
> $query = "SELECT * FROM some_table WHERE some_col = '$user_item' ";
Try an:
echo htmlentities($query);
And you'll see the problem with the query.
Curt.
--