我正在尝试获取存储在数据库中的每个用户的下线数量(用户带来的推荐),例如:
------------------------------------
+ UserID + refferedby
------------------------------------
l 23 l 80
l 25 l 23
l 36 l 25
l 75 l 36
l 98 l 75
l 24 l 98
l 209 l 24
25带来的总推荐量应该是:23,80,36,75,98,24,204
伪:
function getalldownlines(){
// Get all users id and store in array
// loop through the array to get each users total downlines by calling function get_all()
}
function get_all(){
// get all users downline and downlines brought by user to the last user
// it should keep count each and every one of them
return $count;
}
最好的方法是什么?