Re: addslashes()
| From: | Jasper Bryant-Greene | Date: | Wed, 29 Mar 2006 23:29:43 +0000 |
| Subject: | Re: addslashes() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-232877@lists.php.net to get a copy of this message | ||
From http://php.net/addslashes :
"Having the PHP directive magic_quotes_sybase set to on will mean ' is instead escaped with another '."
Jasper
Chris Boget wrote:
Can someone explain something to me: <script language="php"> $string = "Bob's carwash's door"; echo 'addslashes(): ' . addslashes( $string ) . '<br>'; echo 'mysql_escape_string(): ' . mysql_escape_string( $string ) . '<br>'; </script> Outputs: addslashes(): Bob''s carwash''s door mysql_escape_string(): Bob\'s carwash\'s door According to the documentation (http://us2.php.net/manual/en/function.addslashes.php), addslashes() should be doing exactly what mysql_escape_string is doing above (namely, add backslashes in front of each apostrophe). However, it's merely adding an additional apostrophe. Why? I'm running 4.3.11 on Windows NT 5.2 build 3790. thnx, Chris