# Escaping character for amfphp

**URL:** <https://forum.kirupa.com/t/escaping-character-for-amfphp/224362>\
**Category:** Uncategorized\
**Created:** [May 1, 2007, 7:54pm UTC](https://forum.kirupa.com/t/escaping-character-for-amfphp/224362 "2007-05-01T19:54:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazgold](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@jazgold](https://forum.kirupa.com/u/jazgold)\
**Post date:** [May 1, 2007, 7:54pm UTC](https://forum.kirupa.com/t/escaping-character-for-amfphp/224362/1 "2007-05-01T19:54:07Z")

</div>

amfphp is supposed to be easy. for the most part, it is. i love that i can send arrays of arrays and not worry about anything.

i am having trouble though with some things that would be otherwise very basic just POSTing to a php script directly…

when i send a string containing a single quote ( ’ ) and try and use it in a mysql query, the query will fail. addslashes() does not work.

i noticed in the amfphp “common errors” documentation says:

> AMFPHP uses $HTTP\_RAW\_POST\_DATA as its input. This variable is **not** affected by magic quotes. Thus all your service arguments will act as though magic quotes was set to off. If you try to insert something with a quote in it without escaping it you will receive an error back from your sql driver. Use the database specific escaping function on your strings before running SQL, for example mysql\_real\_escape\_string for MySQL.  
> so i tried running

```php

mysql_real_escape_string( $val ) or die("problem trying to escape");
$sql = "UPDATE $tableName SET `$fieldName`='$val' WHERE `item_id`='$id' LIMIT 1";

```

and if $val contains a single quote, then the script dies at the escaping.

any ideas?

ever seen this before?

thanks

jaz
