note 13532 added to function.addslashes.php
| From: | designinghelp at designinghelp dot com | Date: | Wed, 20 Jun 2001 19:26:49 +0000 |
| Subject: | note 13532 added to function.addslashes.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14497@lists.php.net to get a copy of this message | ||
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.
http://www.php.net/manual/en/function.addslashes.php