note 38230 deleted from function.mysql-real-escape-string by aidan

From: Date: Wed, 11 Aug 2004 15:12:54 +0000
Subject: note 38230 deleted from function.mysql-real-escape-string by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-74472@lists.php.net to get a copy of this message
Note Submitter: ---- It appears as though mysql_real_escape_string doesn't get rid of mysql comments, i.e. '--'; I want it to do so, not for security issues but just to keep from having partially inserted data. So here's a function that uses a regular expresion to remove any multiple-hyphen substrings, as well as running mysql_real_escape_string: function escape_data($data){ global $dbc; $pattern='-{2,}'; $data=eregi_replace($pattern,'',$data); return mysql_real_escape_string($data,$dbc); }

« previous php.notes (#74472) next »