0

I currently have this function

processfn('sponsor = 1', 1, '', 0, 'buyer = 0');

function processfn($sponsor, $level, $sad, $sadista, $bumili) {



	$result = mysql_query("SELECT id FROM ahentes WHERE $sponsor") 
	or die(mysql_error()); 
	if (mysql_num_rows($result) > 0) { 
	$sad = mysql_num_rows($result);
	while ($row = mysql_fetch_array($result)){
			
			$sila[] = "buyer = '".$row['id']."' ";
			$output[] = "sponsor = '".$row['id']."' ";
	}
	$sponsor = implode(' or ', $output);
	$tsk = implode(' or ', $sila);


	    processfn($sponsor, $level+1, $sad, $sad+$sadista, $tsk);

 

	}

	}

With the code above, I can successfully get all I need except the "$tsk". Well, it is being displayed but my target is get all the id extracted throughout the recursion and make them as 1 variable. Here's a sample result.

Level 1 result : buyer = 1 or buyer = 2 or buyer = 3
Level 2 result : buyer = 4 or buyer = 5 or buyer = 6

My Goal is make it like this: buyer = 1 or buyer = 2 or buyer = 3 or buyer = 4 and so on..

Thanks in advance geeks! ^_^

3
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by codewalkz
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.