0

Not sure really what to call it. But in my mysql database I have tons of values like this :

 a:2:{i:5;s:10:"likes";i:10;s:10:"likes";}
 a:3:{i:5;s:10:"likes";i:10;s:10:"likes";i:11;s:10:"likes";}

I was under the assumption this is a form of an array and I have seen this before in another databse so I figured it was pretty standard, but kinda stumped now and my question is what would be a query to retrieve the largest of these arrays. so that a:MAXNUM{"likes";} is returned.

If you need me to explain more please ask.

1 Answer 1

2

This is serialized strings. You can unserialize them and they will be objects or arrays. When you unserialize that strings you can simply calculate likes count and max count by yourself. If serialized string was an array you can just do that with simple PHP functions if you used that.

Strings you provide seems to be PHP serialized strings. More about serialization in PHP you can find here.

Anyway you can't unserialize that strings using only MySQL. You need server-side laguage to do that, PHP for example.

Sign up to request clarification or add additional context in comments.

Comments

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.