im scipting something where it allows members to refer people 7 levels down "mlm"
i need to do querys to give number of referrals for each level...
is it possible to do it with using and in a mysql query? for ex.
username & SP are in my d/b username being that members name and sp being their sponsor...
right now i have it giving the number of first level referrals with this query...
$query = mysql_query("SELECT * FROM USERS WHERE SP='$username'");
$count = mysql_num_rows($query);
echo "Level 1 Referrals: " . $count . " <p>";
could i do something like this to get the second level referrals?
$result = mysql_query("SELECT * FROM USERS WHERE '$username' = SP AND SP = username ");
$count2 = mysql_num_rows($result);
echo "Level 2 Referrals: " . $count2 . " <p>";
i got lost half way through i think just by changing around stuff im doing the same thing as my level 1 referrals and will return the same count as my level 1?
if you can help thank you.
if not i understand.
Buddy