开发者

getting a mysql array?

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:1开发者_运维技巧1;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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜