Umair Mehmood Khan Lodhi Umair Mehmood Khan Lodhi - 1 year ago 97
MySQL Question

How to fetch data from Wordpress database tabe wp_postMeta with PHP custom query

I am developing a custom PHP based website and attaching it with WordPress database, I want to fetch data from wp_postMeta, with custom PHP not with WordPress get_post_meta.

The major issue I am facing is to convert multidimensional array and displaying record actually I don't know about that how to convert and display .

See the picture please
enter image description here

Answer Source

So you have already the query but you can't convert this serialized array into a PHP array? Just use the PHP unserialize() function. Take a look at the PHP docs.

unserialize() converts this:

a:2:{i:0;s:12:"Sample array";i:1;a:2:{i:0;s:5:"Apple";i:1;s:6:"Orange";}}

into this:

    [0] => Sample array
    [1] => Array
            [0] => Apple
            [1] => Orange


In your case it could be something like this.. really easy:

$array = unserialize( $queried_data );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download