0
我在MySQL如何在PHP MySql中使用数组结构对Json进行编码?
科
ID Name
=====================
1 Section1
2 Section2
类别
ID SectionID Name
=========================================
1 1 Category1
2 1 Category2
3 2 Category3
我怎样才能解码来自PHP JSON得到看起来像这样的结果2个表:
{版块:[
{sectionName:“Section1”,categoryList:[{categoryName:“category1”},{categoryName:“category2”}]},
{sectionName:“Section1”,categoryList:[{categoryName:“category3”}]}}
]}
这是我现在有:
$ sql_section = “从部分选择*”;
$ sql_category =“select * from category”;
有什么建议吗?谢谢。
你的意思是编码? – 2012-08-16 06:45:54
完全相同的问题http://stackoverflow.com/questions/11982529/how-to-design-an-array-structure-and-encode-to-json-using-php – 2012-08-16 08:49:04