MySQL request to extract clean WordPress array values

How can get a proper list of IDs from an array in MySQL meta\_value that looking like:

a:29:{i:0;s:2:”25″;i:1;s:2:”28″;i:2;s:2:”45″;i:3;s:2:”55″;i:4;s:2:”63″;i:5;s:2:”74″;i:6;s:2:”75″;i:7;s:2:”76″;i:8;s:2:”86″;i:9;s:2:”94″;i:10;s:3:”101″;i:11;s:3:”110″;i:12;s:3:”112″;i:13;s:3:”115″;i:14;s:3:”120″;i:15;s:3:”124″;i:16;s:3:”126″;i:17;s:3:”133″;i:18;s:3:”141″;i:19;s:3:”148″;i:20;s:3:”155″;i:21;s:3:”156″;i:22;s:3:”168″;i:23;s:3:”175″;i:24;s:3:”176″;i:25;s:3:”191″;i:26;s:3:”192″;i:27;s:3:”182″;i:28;s:3:”178″;}

Perfect result would be:

(25,28,45,55,63,74,75,76,86,94,101,110,112,115,120,124,126,133,141,148,155,156,168,175,176,191,192,182,178)

Thanks for your help

1 Comment
  1. The saved value is a serialized array. You can convert it to an array using the PHP function `unserialize()`. You’d need to loop through the returned array of values to extract the 25, 28, etc

    However typically you shouldn’t need to do this yourself – what is saving the data? What is the data from?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer