首页 新闻 会员 周边 捐助

php 如何将树形结构的数据存入mysql中?麻烦大神们看看,

0
悬赏园豆:80 [待解决问题]

// dom几点如下
<
ul id="pid_0"> <li> <input type="text" name="classify" class="form-control one_line" value="一级目录" pid="0" level="1"> <span class="input_sign add first_add" pid="0" sign="add" level="0" ref="child" style="display: none;">[ + ]</span> <ul id="pid_1"> <li> <input class="form-control one_line" pid="0" level="2" name="classify"> <span class="input_sign add" pid="1" level="2" sign="add" ref="child" style="display: none;">[ + ]</span> <span class="input_sign reduce" pid="1" level="2" sign="reduce" ref="sibling">[ - ]</span> <ul id="pid_2"> <li> <input class="form-control one_line" pid="1" level="3" name="classify"> <span class="input_sign add" pid="2" level="3" sign="add" ref="child">[ + ]</span> <span class="input_sign reduce" pid="2" level="3" sign="reduce" ref="sibling">[ - ]</span> </li> <li> <span class="input_sign add" pid="1" level="2" sign="add" ref="sibling"> + </span> </li> </ul> </li> <li> <input class="form-control one_line" pid="0" name="classify" level="2"> <span class="input_sign add" sign="add" ref="child" pid="1" level="2">[ + ]</span> <span class="input_sign reduce" pid="0" level="1" sign="reduce" ref="child">[ - ]</span> </li> <li> <span class="input_sign add" pid="0" level="1" sign="add" ref="sibling"> + </span> </li> </ul> </li> <li id="lastChild_0"><span class="input_sign" pid="0" sign="add" ref="sibling" level="0"> + </span></li> </ul>
雨慢慢下的主页 雨慢慢下 | 初学一级 | 园豆:3
提问于:2018-06-12 15:16
< >
分享
所有回答(2)
0

建一张表  一个ID 一个Name   一个parentId  然后添加父级 parentId 为0    添加下级  对应的parentId 为父级ID   就可以了

雷。 | 园豆:775 (小虾三级) | 2018-06-12 16:51
0

目前已经搞定了

雨慢慢下 | 园豆:3 (初学一级) | 2018-07-17 10:48
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册