note 28626 added to function.addslashes

From: Date: Sat, 18 Jan 2003 11:53:33 +0000
Subject: note 28626 added to function.addslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-42341@lists.php.net to get a copy of this message
For thelogrus, my testing shows the opposite--that a slashed string is stored correctly by MySQL. Consider insert into test (field1) values ('test\'test') ...which is stored as "test'test". If you were posting "Sir'Weaser" from a form to your script and have magic_quotes_gpc on, then the string is slashed already so if you run addslashes() again you will be entering "Sir\\'Weaser" into MySQL. In that case "Sir\'Weaser" would be the correct output. In summary, addslashes() is not necessary if magic_quotes_gpc is on. -- http://www.php.net/manual/en/function.addslashes.php http://master.php.net/manage/user-notes.php?action=edit+28626 http://master.php.net/manage/user-notes.php?action=delete+28626 http://master.php.net/manage/user-notes.php?action=reject+28626

« previous php.notes (#42341) next »