I have data in a MYSQL DB that looks like this:
id,parentid,name,count
1,0,top,10
2,1,middle1,5
3,1,middle2,5
4,3,bottom1,3
5,3,bottom2,2
and want to output it via PHP as a heirarchical JSON string where 'top' has a collection of 'middle's etc.
Get my drift? Anyone have a recursive PHP function to help?