In MySQL (for wordpress) there is the following value in a post_metadata :
a:1:{i:0;a:2:{s:5:"title";s:7:"Payment";s:19:"percentage_complete";s:1:"5";}}
We do :
$value_percentage = array (
0 =>
array (
'title' => 'Payment',
'percentage_complete' => '15',
),
);
$serializedData = serialize($value_percentage);
update_post_meta( $id, $field_percentage, $serializedData );
But in the DB there is :
s:78:"a:1:{i:0;a:2:{s:5:"title";s:7:"Payment";s:19:"percentage_complete";s:2:"15";}}";
How to avoid the s:78:"
?
We also tried the following :
$value_percentage['percentage_complete'] = '15';
but there is the s:78:"
in the DB
You can use maybe serialize and maybe_unserialize function to store and pull data
maybe unserialize
output is like this,
maybe serialize
output is
a:1:{i:0;a:2:{s:5:"title";s:7:"Payment";s:19:"percentage_complete";s:2:"15";}}