Very Wierd Problem
| From: | James E Hicks III | Date: | Sat, 14 Jun 2003 14:53:24 +0000 |
| Subject: | Very Wierd Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-151480@lists.php.net to get a copy of this message | ||
I am experiencing some weird problems with PHP. When I execute the following
query from within a PHP script, the description is set to 'EBCO' and not
'EBCO\030774-006\BUBBLER VALVE'. When I execute this query from the mysql
monitor the value is inserted correctly.
$query = "update the_table
set description = 'EBCO\\030774-006\\BUBBLER VALVE'
where item_number = '1'";
mysql_query($query);
This statement prints to console incorrectly (notice funky character after
EBCO):
echo ("EBCO\030774-006\BUBBLER VALVE");
EBCO774-006\BUBBLER VALVE
This statement prints to console incorrectly (notice funky character after
EBCO):
echo addslashes("EBCO\030774-006\BUBBLER VALVE");
EBCO774-006\\BUBBLER VALVE
This statement prints the variable to the console correctly:
echo ("EBCO\\030774-006\\BUBBLER VALVE");
EBCO\030774-006\BUBBLER VALVE
How can I handle this description correctly with PHP?
James E Hicks III
Noland Company
2700 Warwick Blvd
Newport News, VA 23607
757-928-9000 ext 435
jameshicks@noland.com