//Get all DownlinefunctionGet_all_heeler ($user _id,$user _rank= 0){ $user _id_array=$user _id; while(true) { if(!Empty($user _rank)) { $judge= "and User_rank =".$user _rank; } //get all direct downline and accumulate inside the array $row=$GLOBALS[' DB ']->getall ("Select User_name,user_id,user_rank from".$GLOBALS[' ECS ']->table (' users '). "WHERE parent_id in (".$user _id_array. ")" .$judge); if(!Empty($row)) { $user _id_array=NULL; foreach($row as $key=$value) { $user _id_array.=$value[' user_id ']. ","; //query There is no subordinate $is _heeler.=$GLOBALS[' DB ']->getone ("Select user_id from".$GLOBALS[' ECS ']->table (' users '). "WHERE parent_id =".$value[' user_id '].$judge); } } //to judge if there are any subordinates, if any, continue the loop or exit the loop . if(Empty($is _heeler)) { Break; } $is _heeler=NULL; //Cumulative Results $result.=$user _id_array; //remove the comma at the end to prepare for the next query if(substr($user _id_array,-1) = = ', ') { $user _id_array=substr($user _id_array, 0,strlen($user _id_array)-1); } } //remove the comma at the end $result.=substr($user _id_array, 0,strlen($user _id_array)-1); return $result;}
Record a bit of your own PHP code (1) Get any kind, unlimited level offline