Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
| Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 12th, 2007, 04:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Oklahoma City, Oklahoma, USA.
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default mysql is stripping slashes in serialized array

I have a problem hopefully somebody can help me out with. I am using serialize to store an array in MySQL. One of the values this array is 18" Franco Chain Necklace. What happens is that before it is inserted and I write unserialize($myArray) to the page there is an escape slash in front, so it reads like

a:1:{i:0;a:10:{s:7:"iItemID";i:5;s:8:"ItemName";s: 28:"Assemble your Spur & Rowel ©";s:12:"Descriptions";s:86:"18\" Franco Chain Necklace, 6pt_yg_stone

Now when this value is pulled from MySQL it is stripping the escape slash and will not return the array correctly.

a:1:{i:0;a:10:{s:7:"iItemID";i:5;s:8:"ItemName";s: 28:"Assemble your Spur & Rowel ©";s:12:"Descriptions";s:86:"18" Franco Chain Necklace, 6pt_yg_stone

I know this is the problem because I can update the DB and it works correctly. My question is how can I prevent MySQL from removing my slash. When I insert I am just using
serialize($arrAssemblyCart) I have tried serveral things but none of them work.

mike
__________________
Peace
Mike
http://www.eclecticpixel.com
 
Old December 5th, 2007, 07:16 AM
Authorized User
 
Join Date: Aug 2007
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I think “Serialization in Database” article on
http://aspalliance.com/1093_Serializ...n_Database.all may be helpful in this discussion.

This popular white paper is written by a software engineer from our organization Mindfire Solutions (http://www.mindfiresolutions.com).

I hope you find it useful!

Cheers,
Byapti









Similar Threads
Thread Thread Starter Forum Replies Last Post
storing serialized data in MySQL table ire MySQL 3 November 13th, 2008 06:27 AM
Bringing data from MYSQL to two-dimensional array hotghost PHP How-To 1 September 29th, 2007 02:02 PM
Storing form array data to MySQL using PHP osemollie Beginning PHP 0 February 2nd, 2006 07:32 AM
ASP/MySql database into JavaScript Array Hazzardusa Classic ASP Databases 1 August 14th, 2005 10:02 PM
add slashes and strip slashes madhukp PHP How-To 6 December 27th, 2004 05:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.