RE: [PHP] back slashes
| From: | Richard Lynch | Date: | Mon, 11 Jul 2005 01:42:24 +0000 |
| Subject: | RE: [PHP] back slashes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-218411@lists.php.net to get a copy of this message | ||
On Fri, July 8, 2005 12:48 pm, Jay Blanchard said:
> [snip]
> Lets say I have a string:
>
> "c:\www\test"
>
> I want to insert it into a database, but what ends up getting inserted
> is:
PHP3 and earlier:
http://php.net/addslashes
PHP4 (?) and later:
http://php.net/myqsl_escape_string
> c:wwwtest
>
> I can not get php to double the back slashes no matter what I do!
>
> $string = str_replace("\\", "\\\\", $string);
This "should" have worked, for \, but there are other characters to worry
about...
So you must have made a typo or something when you tried this.
--
Like Music?
http://l-i-e.com/artists.htm