Jump to content

ALMOST infinite loop?


ensellitis

Recommended Posts

Here is the code:

$set_payee_q	=	mysql_query("SELECT * FROM members WHERE ID='$ref'");
while($set_payee	=	mysql_fetch_assoc($set_payee_q)) {

// Get referer's ID
$id = $set_payee['ID'];

// Count rows, see if referer has enough people under him to get payee status
$row_count = get_rows("members WHERE parent='$id'");

// If they have more than 3 people refered
if($row_count >= 4) {
	// Give them payee
	$payee	= $set_payee['ID'];
} else {
	// They have less than 4, so give their parent the payee
	$payee	= $set_payee['parent'];
}
}

 

I need it to keep checking until there is no more parent to check.  And if it finds any parent that has more than 3 people under them, it gives them the payee status.

 

I know there has to be an easy way to do this other than nesting a ton of these over and over again...  Please tell me it is possible.  I am, again, hitting my head on the wall here.  Lol

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.