How can I read the value from mysql using PHP

Following is a value I am seeing in one of my fields in mysql for wordpress database

a:2:{i:0;i:31;i:1;i:23;}

Read More

What is this format? How can I get the valued of alternate I using PHP ?

Related posts

Leave a Reply

3 comments

  1. That’s serialized data, the ‘a’ means array and the 2 represents two child parts of that array.

    What I would recommend though rather than pulling information out via custom queries is to use WordPress’ inbuilt functions (get_posts, get_user_meta etc) which will safely retrieve the data and you can do so much more with it. Plus it’s built for extension meaning you’re not reinventing the wheel each time