note 16284 added to function.mysql-escape-string

From: Date: Tue, 23 Oct 2001 18:55:33 +0000
Subject: note 16284 added to function.mysql-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-19336@lists.php.net to get a copy of this message
If you're wondering what's the difference between mysql_escape_string() and AddSlashes(), I found this from looking at the source code of MySQL 3.23.32 and PHP 4.0.6: - mysql_escape_string calls MySQL's library function of the same name, which prepends slashes to the following characters: NUL (\x00), \n, \r, \, ', " and \x1a. - AddSlashes escapes NUL, ', " and \. While mysql_escape_string seems safer, my experience shows that escaping strings with AddSlashes (which is also done automatically if magic_quotes_gpc is on) is sufficient, so it seems you can pick whichever you wish. -- http://www.php.net/manual/en/function.mysql-escape-string.php http://master.php.net/manage/user-notes.php?action=edit+16284 http://master.php.net/manage/user-notes.php?action=delete+16284 http://master.php.net/manage/user-notes.php?action=reject+16284

« previous php.notes (#19336) next »