开发者

Get a single value form a serial SQL entry

how to I get the single values from an entry like this:

O:8:"stdClass":10:     
{s:4:"mime";s:10:"image/jp开发者_如何学编程eg";s:4:"size";s:6:"238062";s:7:"storage";s:9:"FSStorage";     s:3:"uri";s:26:"kat_bild_mountainbikes.jpg";s:8:"filename";s:26:"kat_bild_mountainbikes.jpg";s:5:"width";s:4:"1000";s:6:"height";s:3:"595";s:3:"alt";s:0:"";s:5:"title";s:0:"";s:8:"settings";s:0:"";}

I want to get the image path, there. What is the best an fastest way, to do that?


REALLY bad idea to try to do it with SQL...

But if the structure of the serialized information is always the same, you "could" use substring_index...

 SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(<column>, '"',6),'"',-1) AS Image_Path
 FROM `<table>` 

Simply replace <column> and <table> with the appropriate names...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜