Very Weird Problem Continued
| From: | James Hicks | Date: | Sun, 15 Jun 2003 13:44:29 +0000 |
| Subject: | Very Weird Problem Continued | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-151576@lists.php.net to get a copy of this message | ||
The following variable needs to be escaped before it can be submitted as an
MySQL query. It seems that the \0 in this string is causing me the problem. I
have tried several functions in an attempt to escape this variable. Anybody
got any other suggestions. The resulting string should look like this:
EBCO\\030774-006\\BUBBLER VALVE
$variable = "EBCO\030774-006\BUBBLER VALVE";
Things I have tried so far that do not work. Every one of the following
functions results in \030 being replaced with a weird character.
echo addslashes($variable);
echo str_replace("\","\\",$variable);
echo mysql_escape_string($variable);
Here is the result of all of the above functions ( notice weird character
after EBCO and that all the functions successfully escape the second \
character in between the 6 and the B in BUBBLER):
EBCO▒774-006\\BUBBLER VALVE
James