< table >
< thead > < tr > < th > Classification Table: < / th > < / tr > < / thead >
< tbody >
< tr >
< td > id < / td >
< td > department < / td >
< td > pid < / td >
< td > level < / td >
< / tr >
< tr >
< td > 1 < / td >
< td > Administration < / td >
< td > 14 < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 2 < / td >
< td > Marketing < / td >
< td > 14 < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 3 < / td >
< td > Finance < / td >
< td > 14 < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 4 < / td >
< td > Ministry of Foreign Trade < / td >
< td > 14 < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 5 < / td >
< td > General Administration < / td >
< td > 14 < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 6 < / td >
< td > bidding Department < / td >
< td > 14 < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 7 < / td >
< td > Engineering < / td >
< td > 14 < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 8 < / td >
< td > R & D Department < / td >
< td > 14 < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 9 < / td >
< td > sales < / td >
< td > 14 < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 10 < / td >
< td > domestic sales Department < / td >
< td > 14 < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 11 < / td >
< td > South China < / td >
< td > 10 < / td >
< td > 2 < / td >
< / tr >
< tr >
< td > 12 < / td >
< td > North China < / td >
< td > 10 < / td >
< td > 2 < / td >
< / tr >
< tr >
< td > 13 < / td >
< td > East China < / td >
< td > 10 < / td >
< td > 2 < / td >
< / tr >
< tr >
< td > 14 < / td >
< td > Guangzhou < / td >
< td > 0 < / td >
< td > 0 < / td >
< / tr >
< tr >
< td > 15 < / td >
< td > Guangdong < / td >
< td > 0 < / td >
< td > 0 < / td >
< / tr >
< tr >
< td > 16 < / td >
< td > template < / td >
< td > 15 < / td >
< td > 1 < / td >
< / tr >
< / tbody >
< / table >
< table >
< thead > < tr > < th > Datasheet < / th > < / tr > < / thead >
< tbody >
< tr >
< td > id < / td >
< td > name < / td >
< td > phone < / td >
< td > weixin < / td >
< td > qq < / td >
< td > email < / td >
< td > did (associated category ID) < / td >
< / tr >
< tr >
< td > 1 < / td >
< td > Zhang San < / td >
< td > 10086 < / td >
< td > test < / td >
< td > 10000 < / td >
< td > 10000@qq.com < / td >
< td > 1 < / td >
< / tr >
< tr >
< td > 2 < / td >
< td > Li Si < / td >
< td > 13800138000 < / td >
< td > test1 < / td >
< td > 123456 < / td >
< td > 123456@qq.com < / td >
< td > 2 < / td >
< / tr >
< tr >
< td > 3 < / td >
< td > Xiao Ming < / td >
< td > 13888888888 < / td >
< td > test23 < / td >
< td > 987654 < / td >
< td > 98654@qq.com < / td >
< td > 11 < / td >
< / tr >
< / tbody >
< / table >
< hr >
$id = 14
public function selectRosterList($id)
{
$data = db("department")->where("pid",$id)->select();
$rosters = [];
foreach ($data as $key=>$value){
$roster = db("roster")->where("did",$value["id"])->select();
$rosters = array_merge($rosters, $roster);
if ($value["pid"] != 0){
$this->selectRosterList($value["id"]);
}
}
return $rosters;
}
Why can I only get the data of Zhang San and Li Si but not Xiaoming when I write like this?