note 13532 deleted from function.addslashes by philip
| From: | philip@php.net | Date: | Tue, 20 Jul 2004 17:22:15 +0000 |
| Subject: | note 13532 deleted from function.addslashes by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73718@lists.php.net to get a copy of this message | ||
Note Submitter: designinghelp@designinghelp.com
----
On problem I had to figure out was adding slashes to a string, inserting into mysql, adding more
slashes, and inserting into a file.
To do this on all the servers I tested it on correctly I did this:
if (!get_magic_quotes_gpc()) {
$message = addslashes($message);
$message = str_replace('$', '\$', $message );
}
insert to mysql
$message = str_replace("\\" , "\\\\", $message );
$message = str_replace('$', '\$', $message );
insert to file
From my testing that works completely.