I'm New in php & practicing a MLM Project, So i want know how to Calculate this & echo the Stages. MLM01

Member Avatar for diafol

Firstly, your table isn't DB friendly. This would have to come from multiple tables (see normalisation) in a related model.

I suggest:

members table
stage table

to begin with

You need to provide more info on the left/right field and if there's any mathematical relationship to the commision field.

Member Avatar for LastMitch

I agree with diafol said regarding about DB not friendly. I'm not too fond on MLM job pyramid idea.

Here is an example of a MLM Calculator:

http://www.webwinder.com/calculators/mlm_com_calc.html

It is in javascript in order to caluclate the data.

If you need a DB then you can combine both php & javascript

Its a Simple Database. ID, Username, Left_leg, Right_Leg.
The Condition is: if (left_leg==30 && Right_Leg==60) or (left_leg==60 && Right_Leg==30) then echo "You are JUNIOR PLATINUM MEMBER & Your Commission is 4444/-"

Member Avatar for diafol

It may be a simple DB, but you give no details of your SQL DB table structure. Neither have you mentioned any specific relationship between left/right and commission. If you do need help, it may be in your interest to supply this info and anything else that may be required. As of this moment, you haven't supplied any code or sql data.

I'm New so dont know anything. Please do as your idea.
Details---> right now DONT Create any DATABASE or Stare data.
Simple printing the "Stage" by use "if" comand or anything that yuou know.
Here is Two Text field named "txt_Left" & "txt_right"

when clicked submit button, this calculate
if (txt_left==30 && Right_Leg==60) or (txt_left==60 && Right_Leg==30) then echo "You are JUNIOR PLATINUM MEMBER & Your Commission is 4444/-"

You said "practicing a MLM Project". Personally I feel MLM is really complicated kind of data and calcuations, having lots of scope for error if db not designed properly.

I would like to know that have u pracitsed (insert, update, calculate) on normal database table structures, if not you start with simple things in php mysql, then you practise on complex databases.

And if you are trying to learn complex if conditions then you can do it by using switch statement like following

$leftleg="60";
$rightleg="30";

$landr=$leftleg.",".$rightleg;

switch ($landr)
{
    case  "1,1":
        echo "You are fresher & Your Commission is 500/-"
        break;


    case  "60,30":
    case  "30,60:
        echo "You are JUNIOR PLATINUM MEMBER & Your Commission is 4444/-"
        break;
.
.
.
.
.
}
commented: Thanks a lot +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.