note 49067 deleted from function.mysql-escape-string by danbrown
| From: | danbrown@php.net | Date: | Wed, 12 Aug 2009 21:49:35 +0000 |
| Subject: | note 49067 deleted from function.mysql-escape-string by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159412@lists.php.net to get a copy of this message | ||
Note Submitter: boris-pieper AT t-online DOT de
----
Using a function like escape_string make sure you allways use optimal escape function...
Note: You should use mysql_real_escape_string() (http://php.net/mysql_real_escape_string) if
possible (PHP => 4.3.0) instead of mysql_escape_string().
<?php
function escape_string ($string) {
if(version_compare(phpversion(),"4.3.0")=="-1") {
mysql_escape_string($string);
} else {
mysql_real_escape_string($string);
}
}
?>