> 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?
# is used to start a comment in MySQL. Show your actual code around this statement where you make your query. The only reason the data would be cut off is if MySQL is interpreting the # as the beginning of a comment. But, if that was the case, you'd have an invalid query, so it must be a combination of things. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php