note 98506 deleted from function.mysql-real-escape-string by philip
| From: | philip@php.net | Date: | Fri, 04 Sep 2015 20:00:17 +0000 |
| Subject: | note 98506 deleted from function.mysql-real-escape-string by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203666@lists.php.net to get a copy of this message | ||
Note Submitter: adelbenzarti at yahoo dot fr
----
The function mysql_real_escape_string helps the developer to insert data without having troubles in
the process or having risks of SQL Injection.
You can develop a similar function :
<?php
function escape($str)
{
$search=array("\\","\0","\n","\r","\x1a","'",'"');
$replace=array("\\\\","\\0","\\n","\\r","\Z","\'",'\"');
return str_replace($search,$replace,$str);
}
?>