I am trying to grab data from the DB using WPDB but I am stuck on how to decrypt the data e.g.
The data is stored as: a:2:{i:0;s:2:"92";i:1;s:2:"71";}
I want the 92 & 71 as that's my post IDs, how to I get that part from the DB using WPDB?
My code so far is:
$crosssells = $wpdb->get_results(
"SELECT *
FROM $wpdb->postmeta
WHERE _crosssell_ids != ''
"
);
The table is only created when data is in putted in the post so I need to check if the table exists and then grab the post id's
postmetatable automatically created & exists. Regarding the data, it's serialized, you can use functionmaybe_unserialize()to convert it to array or object.