Re: Serialize...Unserialize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hutchins, Richard wrote:

I have an array of values I want to store in a MySQL db in a column called
readBy of type TEXT. I want to take that array and serialize it then insert
it into the db. No big deal. When I query the db and get the value from the
readBy column, I know I have to unserialize it. Again, no big deal.

My question about all of this is once I unserialize the data from the
column, can I immediately use the array_push() function to append additional
data to the unserialized data?
I would imagine because the output of unserialize() is of the array type. Unless, there was an error unserializing it.

Will the unserialized data immediately be
recognized/treated as an array?
Yes.

Also, is the TEXT dolumn type an appropriate
column type to store serialized data or is there another column type that
should be used?

If you can guarantee that the data doesn't go above 256 characters, then a varchar column can be used.
But serialized data can get pretty big, so anticipate for it, by using text columns.

--
Gerard Samuel
http://www.trini0.org:81/
http://test1.trini0.org:81/



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux