I'm having a problem to show users in my referral system.
If you look at table you'll notice userid
'29' was refered
by '28';
and '28' by '26';
also '26' by '10'
When user session '29' is active the page should display above users. Hope you got the idea.
Referal table:
Code:
<?php
$rs=mysql_query("select userid from referal where refereduserid='29'") or die(mysql_error());
$exitloopcount=mysql_num_rows($rs);
$last=mysql_fetch_array($rs);
if ($exitloopcount>0)
{
for($i=0;$i<$exitloopcount;$i++)
{
$rs=mysql_query("select userid from referal where refereduserid='".$last[$i]."'");
while($data=mysql_fetch_array($rs))
{
echo $data[$i];
}
}
}
?>