Unserialize data from mysql

in my mysql cell this is saved using serialization function

a:1:{i:0;s:275:"a:4:{s:8:"khghg_id";s:10:"foo1187";s:3:"uri";s:21:"foo/vtory/1187";s:4:"name";s:5:"nmart";s:5:"tuhlmb";a:3:{i:0;s:40:"knuujhs/201205/13_03_pceb9.jpg";i:1;s:40:"knuujhs/201205/13_03_0wlih.jpg";i:2;s:40:"knuujhs/201205/13_03_tq5wf.jpg";}}";}

I'm trying to do unserialize

I am using this code

$cell =$row9['attachment'];
$list = unserialize($cell);
$info = unserialize($list[0]);
var_dump($info);

when i try with this i get bool (false) error so i tried with parse_str with parse_str i got no error

 parse_str($cell,$list );

but i don't get the output in my database i save the output in the database and i send the request to the database. Everything becomes stored except for these non-esterialized values. Here you can see that there is

khghg_id which is foo1187 uri which is foo / vtory / 1187 name which is nmart
I want to store this data in my database, so I use

'.$info['khghg_id'].'   for sending the data to mysql but mysql stores everything  other than  all unsterilized  values
+3
source share
1 answer

You are extracting serialized text from the database.

.. , , ,

//retrieve serialized data from database
$arr = unserialize($row['properties']);

//get the desired value
$khghg_id = $arr['khghg_id'];

//now insert $khghg_id in database

, . , 2 ..

$cell =$row9['attachment'];
$list = unserialize($cell);
$info = $list[0]; //this line should make the difference
var_dump($info);
+2

All Articles