note 71609 added to function.mysql-real-escape-string
| From: | federico at nextware dot it | Date: | Thu, 07 Dec 2006 14:19:43 +0000 |
| Subject: | note 71609 added to function.mysql-real-escape-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120377@lists.php.net to get a copy of this message | ||
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);
----
Server IP: 80.241.173.254
Probable Submitter: 81.29.232.251
----
Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php
Edit -- https://master.php.net/note/edit/71609
Del: integrated -- https://master.php.net/note/delete/71609/integrated
Del: useless -- https://master.php.net/note/delete/71609/useless
Del: bad code -- https://master.php.net/note/delete/71609/bad+code
Del: spam -- https://master.php.net/note/delete/71609/spam
Del: non-english -- https://master.php.net/note/delete/71609/non-english
Del: in docs -- https://master.php.net/note/delete/71609/in+docs
Del: other reasons-- https://master.php.net/note/delete/71609
Reject -- https://master.php.net/note/reject/71609
Search -- https://master.php.net/manage/user-notes.php