0

I've been killing myself with this database trying to extract the right data so I hope you can help me!

After trying a number of SQL editors (MySQL WorkBench, Sequel Pro and RazorSQL and PHPMyAdmin) I haven't been able to figure out how to decode this strange output of a BLOB column:

a:1:{i:0;a:3:{s:3:"src";s:30:"joburg-vic-falls-11-days-0.jpg";s:3:"alt";s:0:"";s:4:"desc";s:0:"";}}

The above is for an image as you can perhaps see by the slug.jpg. Can any of you tell me what code this is so I can decode it somewhere to make it useful?

I am moving a database from Contao to WP and having to manually piece it together. Decoding this will get me a lot further along. Thanks in advance for your help!

5
  • 3
    that's a php serialized array. php.net/serialize, or if not php, at least something similar. Commented Jun 2, 2014 at 17:58
  • That's great thank you @MarcB . I take it I can "unserialize" it then? Commented Jun 2, 2014 at 18:04
  • yes. there's unserialize(). but the format's simple enough. a:1 - array with 1 element, i:0 integer with 0 value, s:3, string with 3 chars, etc... Commented Jun 2, 2014 at 18:21
  • Thanks to @MarkB's comment I've managed to find this answered question to help me fix my insane data: stackoverflow.com/questions/8547009/… I also found this link where you can unserialize data like this online: blog.tanist.co.uk/files/unserialize I'll probably try to write this function into bit of a script I can run on entire columns of my database... Commented Jun 2, 2014 at 18:23
  • Yeah I see that. I need the data in the array's though so i'll need to unserialize and then use the items in the array to generate html or text Commented Jun 2, 2014 at 18:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.