function getNodeInsertPostionByParentId($parentId){ $position = array('status'=>false); $parents = array(); foreach($parentId as $parent){ $qry = "select customer_id,node_direction from mlm_nodes where parent_id =".$parent." order by node_direction"; $rst = mysql_query($qry); $count = mysql_num_rows($rst); if($count==2){ while($row = mysql_fetch_assoc($rst)){ $parents[$parent][] = $row['customer_id']; } }elseif($count==1){ $position['status'] = true; $position['parentId'] = $parent; $position['node'] = 'R'; //echo '<pre>1';print_r($position);echo '</pre>'; return $position; }else{ $position['status'] = true; $position['parentId'] = $parent; $position['node'] = 'L'; //echo '<pre>2';print_r($position);echo '</pre>'; return $position; } } return $this->searchByParents($parents); } function searchByParents($parents){ foreach($parents as $parent){ return $this->getNodeInsertPostionByParentId($parent); } } echo '<pre>';print_r($this->getNodeInsertPostionByParentId(array('4')));die;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)