Drian Drian Drian Drian - 3 months ago 24
MySQL Question

extract specific data from array in mysql database using php

This is the data that i need to extract like example profile_contact_numbers
so the output will be +639466276715

how can i do it in php code??
any help will do regards
a:2:

{s:23:"profile_contact_numbers";s:13:"+639466276715";s:16:"profile_position";s:7:"Courier";}

Answer Source

I'm not sure 100% this can go into an array but try the unserialize function

$json_resp = {your values};
$array[] = unserialize($json_resp);

To check if it has gone into an array print_r on $array.

Read this link if the code above doesn't work

http://php.net/manual/en/function.unserialize.php

I have managed to fix it

$serialized = array(unserialize('a:2:{s:23:"profile_contact_numbers";s:13:"+639466276715";s:16:"profile_position";s:7:"Courier";}'));
var_dump($serialized);