1 reply [Last post]
jaymeh's picture
Offline
Joined: 12/08/2009
Juice: 46
Was this information Helpful?

Full Example:
a:3:{s:10:"attributes";a:1:{s:24:"Battery Size / Packaging";a:1:{i:0;s:31:"Size 10 (60/carton) (not shown)";}}s:9:"shippable";s:1:"1";s:6:"module";s:10:"uc_product";}

Part I have concerns about:
{i:0;s:31:"Size 10 (60/carton) (not shown)";}

Shouldn't that 0 after the {1: be the aid, something other than 0? Please tell me if I'm wrong.

drupalfever's picture
Offline
Joined: 05/14/2011
Juice: 45
How to analize serialized data.

I know that this post was made a long time ago, but for those that may have difficulty understanding serialized content on the database I have a trick that I wanted to share.

1) First, make sure you have "Devel" module enabled on your website.
2) Go to the "Blocks" page and enable the "Development" block.
3) On the Development menu click on "Execute PHP Code"
4) Now, on the code window, type the following:

<?php

$string

='a:3:{s:10:"attributes";a:1:{s:24:"Battery Size / Packaging";a:1:{i:0;s:31:"Size 10 (60/carton) (not shown)";}}s:9:"shippable";s:1:"1";s:6:"module";s:10:"uc_product";}';

dsm(unserialize($string));

?>

IMPORTANT! : Do NOT include the <?php ?> tags

5) Click on the "Execute" button at the bottom.

The Devel module's dsm function will format the unserialized array in a very comprehensive way.