What I am trying to do with the script:
I have a database of thousands of members and want to build a tree view of people based on their "memberid" number and their "enrollers id" number (the memberid number of the person that enrolled them into the company) The PHP script which I have attached does this very smoothly and very quickly, but I need to add some code to the script.
What I Need Added:
When a person orders from me each month, the total of the order is inserted to a mysql field in my database called "mbvpersonal". I need to add up all these order totals for each member that is below the root member of the tree.
How the Script Currently Works:
The script uses two functions to draw a TREE view of the people placed below the root member. This is tracked via two id numbers:
memberid: the id number of the person
mcomeid: the enrollers id number of the member (the person that enrolled them into the company)
The script runs very fast because I am only making 1 call to the database to get all the members information. Then, I sort all that information with a recursive function. I can not make more then the 1 call to the database as I have thousands of members I am building the tree view on and making more then 1 call would take up too much time and memory.
Here is what I need added to the script:
Each person in the database has a field called mbvpersonal. This field is just a number to represent how much product they purchased this month. I need to add up all these numbers for the tree and have the result returned in a variable called "totalbv"
You will need to do any work on this script on your own server. I actually think it should be a quick and easy addition for someone that really knows what they are doing, but I just can't seem to figure it out. I am in a hurry and need this done as quick as possible.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
Apache Linux Machine
PHP
MySQL