Serielization for MySql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
drayfuss
Forum Newbie
Posts: 24
Joined: Sun Apr 25, 2010 4:57 pm

Serielization for MySql

Post by drayfuss »

Hi,

I was wondering if there is any way of knowing whether data in a database has been serialized?

I'm working on a Database class which allows the option of inserting a serialized array value into a row on a database. When I run a SELECT query on the database, I want to be able to know if the result should be deserialized before I return it to the model that's requesting it. Or am I just going to have to keep an eye on what I do/don't serialize?

Thanks,

drayfuss
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Serielization for MySql

Post by Benjamin »

All records in a particular field should either be serialized or not. You should never have a field which may or may not contain serialized data.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Serielization for MySql

Post by John Cartwright »

I agree with Benjamin on this. However, for the sake of the issue at hand, a php.net commenter posted a solution to this here.
Post Reply