I am working on this database in which the data is serialized and its in multidimensional array. I am trying to retrieve the data into CSV file. One more thing to mention is being saved from WordPress. I read that WordPress automatically serialize the data and saves to database. What would be the best practice to retrieve the data and is it possible to chose the data which is saved in each array. This is the first time I am working with WordPress so any help would be great
Here is what I am doing right now:
$values = mysql_query("select userid,metavalue from wp_usermeta where meta_key='course_progress'");
while ($rowr = mysql_fetch_row($values)) {
$sdata = array();
$sdata = maybe_unserialize( $rowr[1] );
$csv_output .= '"'.$rowr[0].'"';
foreach ( (array) $sdata as $value) {
$csv_output .= ',"'.implode("::",$value).'"';
}
$csv_output .= "n";
}
1 comment
Comments are closed.