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?


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

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to