Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6992621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:39:31+00:00 2026-05-27T19:39:31+00:00

Anyone give me any Idea about How I can Count down-line for a MLM

  • 0

Anyone give me any Idea about How I can Count down-line for a MLM project (PHP/MySQL). Currently I’m using the below method. but when my database record become 300 or more, then it shows: maximum execution time of 30 second exceeded in line 51. (I think this happens for unlimited loop). please help me. what should be proper way?

MY CURRENT CODE:

<?php
require_once('configuration.php');

/// main function which will return Total Node Count
function nodecount($id) {
   $query = "SELECT * FROM ".memberlogtbl." WHERE locationid='".$id."' and topup >'0'";
   $result = mysql_query($query);
   $count = mysql_num_rows($result);

   $_SESSION['hackx8'] = $_SESSION['hackx8'] + $count;
   while($row = mysql_fetch_array($result, MYSQL_BOTH)) {
      nodecount($row["id"]);
   }
   mysql_free_result($result);
   return "";
}

$q_l = mysql_query("SELECT `left`,id FROM ".memberlogtbl." WHERE `left` >'0' ORDER BY id ASC");
while($updt_tbl_l = mysql_fetch_row($q_l)) {
   unset($_SESSION['hackx8']);
   $total_l = nodecount($updt_tbl_l['0']).$_SESSION['hackx8'] + 1;
   mysql_query("UPDATE ".memberlogtbl." SET totalleft='$total_l' WHERE id='".$updt_tbl_l['1']."'");
}
/// Update database with letest Total right Count
$q_r = mysql_query("SELECT `right`,id FROM ".memberlogtbl." WHERE `right` >'0' ORDER BY id ASC");
while($updt_tbl_r = mysql_fetch_row($q_r)) {
   unset($_SESSION['hackx8']);
   $total_r = nodecount($updt_tbl_r['0']).$_SESSION['hackx8'] + 1;
   mysql_query("UPDATE ".memberlogtbl." SET totalright='$total_r' WHERE id='".$updt_tbl_r['1']."'");
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:39:32+00:00Added an answer on May 27, 2026 at 7:39 pm

    i’ve done a similar project. what i did was (after doing a lot of research/googling) use a left and right values for each node in the binary tree. i can’t remember where i read about this method but it works.
    if there are 6 nodes for example, the top/root node would get 1 & 12 as it’s LEFT & RIGHT values respectively. you can then get its total downline by (RIGHT – LEFT – 1) / 2, i think.
    i hope this could help you on your project. : )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of any resources that can give me an idea of how
can anyone give me any advice on what to do about this error ?!
Can any one help me to give some hint about How can i implement
Could anyone please give a sample or any link that describes how to spawn
Can any one give me the difference between Itemsource and DataContext of Listview in
Can anyone give me a complete list of string manipulation function in Microsoft SQL
Can anyone give me pointers to good books or web sites that teach how
Can anyone give me details of runtime error 3734 in Access vba. For reference
Can anyone give a concise set of real-world considerations that would drive the choice
Can anyone give me a scenario where they think busy cursors are justified? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.