[thelist] mysql table field - storing multiple values

Bob Meetin bobm at dottedi.biz
Thu Aug 23 19:40:41 CDT 2012


[{"id":"1","value":["1","3"]},{"id":"2","value":"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam turpis pede, vulput ate a, porta at, venenatis in, mi. Vivamus sagittis euismod felis. Aliquam ligul a risus, rhoncus sed, accumsan ac, ornare sed, est. In hac habitasse platea dict umst. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec consequat luctus felis.<\/p>"},{"id":"4","value":"james bond"},{"id":"14","value":""},{"id":"5","value":"1999"},{"id":"3","value":""},{"id":"12","value":"2"},{"id":"13","value":""},{"id":"7","value":""},{"id":"17","value":""},{"id":"8","value":""},{"id":"6","value":""},{"id":"16","value":""},{"id":"9","value":""},{"id":"10","value":""},{"id":"11","value":""},{"id":"18","value":""},{"id":"15","value":""},{"id":"19","value":""},{"id":"20","value":""}]

The text represents a single field (called extra_fields) of a mysql table which I have to work with, cannot change the construct.  Using mysql or php, is there a correct way to parse out the content so that I can work with each element stored in the table?

The first element, id: 1 stores 2 values from a multiple select list, 1, 3 -->> {"id":"1","value":["1","3"]}
The second, id: 2 stores HTML text which may contain just about anything.

-Bob


More information about the thelist mailing list