note 86814 deleted from function.mysql-real-escape-string by danbrown
| From: | danbrown@php.net | Date: | Wed, 05 Nov 2008 14:48:12 +0000 |
| Subject: | note 86814 deleted from function.mysql-real-escape-string by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146163@lists.php.net to get a copy of this message | ||
Note Submitter: phpdealer at gmail dot com
----
<?php
/**
* Function to replicate mysql_real_escape_string
*
* @param string $text
* @return string
*/
function db_clean($text){
$replace = array(
"\x00" => '\x00',
"\n" => '\n',
"\r" => '\r',
'\\' => '\\\\',
"'" => "\'",
'"' => '\"',
"\x1a" => '\x1a'
);
return strtr($text, $replace);
}