note 101351 deleted from function.mysql-real-escape-string by danbrown
| From: | danbrown@php.net | Date: | Sun, 12 Dec 2010 02:48:36 +0000 |
| Subject: | note 101351 deleted from function.mysql-real-escape-string by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174808@lists.php.net to get a copy of this message | ||
Note Submitter: jkulak
----
I'm using adelbenzarti's escape function, but additionally I'm escaping % character,
as it is a special character for MySQL as well:
function escape($value)
{
$search = array("\\", "\0", "\n", "\r", "\x1a",
"'", '"', '%');
$replace = array("\\\\", "\\0", "\\n", "\\r",
"\Z", "\'", '\"', '\%');
return str_replace($search, $replace, $value);
}