How to unserialize data from MySQL

enter image description here

I’m trying to unserialize data from WP’s MySQL table.
It looks like this

my function from template-page.php

function get_values(){
        global $wpdb;
        $parsed = $wpdb->get_results("SELECT option_value FROM wp_options WHERE option_id = 375", ARRAY_N);
        $result = var_export($parsed[0][0], true);
        echo $result;

the output on my page is a very long string of serialized data:

I’ve tried unserialize($result); and then print it out on my page but it’s not working.
gettype() shows that it’s FALSE, which probably means something wrong with serialized data? But as I’m new to WP/php I think it’s probably my fault somewhere.

What I need to do is simply get the data from MySQL -> transform it to php object -> change some variables -> and push it back to MySQL table.
Where I missed something? thanks!

Read more here:: How to unserialize data from MySQL

Leave a Reply

Your email address will not be published. Required fields are marked *