json unserialize or something else?

Pro
  • 114 points
    Serious WPMU DEV-ster
    I'm helpful
    Giovanni

    Member  —  5th February 2012 (3 months ago)         

    I have this in my usermeta table:

    a:2:{s:5:"yesno";s:3:"yes";s:6:"updown";s:2:"up";}

    How can I grab the values from it using php??

    I have this but it produces nothing:

    $jsonS2 = get_user_meta($user_ID,'wp_s2member_custom_fields');
    $decoded = unserialize($jsonS2);
    foreach ($decoded as $key => $val)
    {
    if($key==$field)
    {
    return "<span class=\"userinfo\">" . $val . "</span>";
    }
    }

    any help would be appreciated.