<?php
function getDownline($idMember, array $downline = array()){
$sql = "select * from nama_table where idparent='$idMember'";
$rs = mysql_query($sql);
while($member = mysql_fetch_array($rs)){
$downline[] = $member;
$downline = $this->getDownline($member['idmember'], $downline);
}
return $downline;
}
//cara pake
$downline = getDownline(1);