数据库
怎么输出为这样的
<select><option value="8">111111</option><option value="13">*121212</option><option value="14">*32323232</option><option value="9">22222222</option><option value="10">*333333</option><option value="11">**44444444</option><option value="12">***555555</option><option value="17">***werwerwer</option><option value="19">**6565656</option><option value="15">*23232323</option><option value="16">**324234234</option></select>
你这里不需要子id,有父id就行啦,你根据classid查询子id就行了
有父id,featherclass=classid,就能到到classid的下级
你这是想做什么??
有父id,featherclass=classid,就能到到classid的下级
$class = $this->tclass->get_all_class($this->tbname); $json_class = Array(); $json_class2 = array(); foreach ($class as $key=>$value) { if($class[$key]['sonclass']) //如果有子分类 { $json_class[$key]['id'] = $value['classid']; $json_class[$key]['text'] = $value['classname']; $son_arr = $this->tclass->get_son_class($value['sonclass'],$this->tbname); foreach ($son_arr as $k=>$v) { $json_class1[$k]['id'] = $v['classid']; $json_class1[$k]['text'] = $v['classname']; } $json_class[$key]['children'] = $json_class1; } }