Number Sign in String Variables
| From: | Joab Ben Stieglitz | Date: | Fri, 17 Jan 2003 20:25:57 +0000 |
| Subject: | Number Sign in String Variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132040@lists.php.net to get a copy of this message | ||
I have a MySQL database that includes data with the # sign in some data
fields. My PHP script pulls the data out of the database fine, but when I
got to write back to the database, I get errors because the string gets
truncated at the # sign. For example:
$query = "INSERT INTO order_detail
SET customer_id = -1,
order_id = $order_no,
item_id = $item_id,
item_num = \"$item_num\",
unit = \"$unit\",
short_desc = \"$short_desc\",
quantity = $quantity,
wholesaler = \"$wholesaler\",
cost = $cost,
sale_price = $sale_price";
This statement fails if $short_desc contains a # sign. The string stops at
the # sign, and all the subsequent fields are empty or garbage.
None of the various resources I have looked at indicate that the # sign is a
special character. Any suggestions?
--
Joab Ben Stieglitz
jstieglitz@st-i-e-g.org