addslashes()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux