How to edit serialized content in mysql

2037 views php
8

I am wondering if it is at all possible to edit an array that was serialized and stored in mysql directly in my mysql?

I am working with a plugin in WordPress that stores an array in mysql (serialized) but I need to change some of the array's values. I was hoping to edit the serialized string in the database but whenever I do the plugin is no longer able to read any of the data.

Is there a way I can edit the serialized data directly without breaking how the plugin reads it?

Cheers!

answered question

I know how to unserialize it. But I want to edit the serialized string directly in mysql.

That seems like monumentally bad idea.

1 Answer

7

Unserialize it and then serialize it again. Those are basic php functions.

$array = unserialize($serialized_data);
//do stuff to $array

$serealize = serialize($array);

posted this

Have an answer?

JD

Please login first before posting an answer.