note 71609 deleted from function.mysql-real-escape-string by nlopess
| From: | nlopess@php.net | Date: | Sun, 31 Dec 2006 12:23:28 +0000 |
| Subject: | note 71609 deleted from function.mysql-real-escape-string by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121137@lists.php.net to get a copy of this message | ||
Note Submitter: federico at nextware dot it
----
if in the string are escape char \ this function does not work properly
if you try to escape this string test '\"text\"' the result is
test \'\\"text\\"\' but if you pass this mysql_query this will return an error
the corret result of escape string is test \'\\\"text\\\"\' to do this you need
to use:
str_replace('\\','\\\\',$TextToEscape);
mysql_real_escape_string($TextToEscape);