MLM (Multi Level Marketing) Database Logic

Here i am going to explain about the login for MLM database.

MLM database means Multi Level Marketing. When a new user will be registered, all the sponsers in chain will get commission. Please find below the code for the same:

Here are form fields:

$sid = $_POST[‘textfield2’];
$name = $_POST[‘textfield3’];
$email = $_POST[‘textfield4’];
$address = $_POST[‘textfield42’];
$profession = $_POST[‘textfield5’];
$birthdate = $_POST[‘textfield6’];
$birthtime = $_POST[‘textfield52’];
$country = $_POST[‘textfield7’];
$state = $_POST[‘textfield8’];
$city = $_POST[‘textfield9’];
$gender = $_POST[‘select’];
$phone = $_POST[‘textfield10’];
$landline = $_POST[‘textfield102’];

$query5 = “select id from registration where id = ‘$sid'”;
$result5 = mysql_query($query5,$con) or die (mysql_error());
if(mysql_num_rows($result5) == 0)
{
mysql_close($con);
die (“Sponser Does Not Exists”);
}

This is 10 level database

$query1 = “select id from registration where id = ‘$sid‘”;
$result1 = mysql_query($query1, $con) or die (mysql_error());
if(mysql_num_rows($result1))
{
$data = mysql_fetch_row($result1);
$sid1 = $data[0];
}

$query2 = “select sid from registration where id = ‘$sid1‘”;
$result2 = mysql_query($query2, $con) or die (mysql_error());
if(mysql_num_rows($result2))
{
$data = mysql_fetch_row($result2);
$sid2 = $data[0];
}

$query3 = “select sid from registration where id = ‘$sid2‘”;
$result3 = mysql_query($query3, $con) or die (mysql_error());
if(mysql_num_rows($result3))
{
$data = mysql_fetch_row($result3);
$sid3 = $data[0];
}

$query4 = “select sid from registration where id = ‘$sid3‘”;
$result4 = mysql_query($query4, $con) or die (mysql_error());
if(mysql_num_rows($result4))
{
$data = mysql_fetch_row($result4);
$sid4 = $data[0];
}

$query5 = “select sid from registration where id = ‘$sid4‘”;
$result5 = mysql_query($query5, $con) or die (mysql_error());
if(mysql_num_rows($result5))
{
$data = mysql_fetch_row($result5);
$sid5 = $data[0];
}

$query6 = “select sid from registration where id = ‘$sid5‘”;
$result6 = mysql_query($query6, $con) or die (mysql_error());
if(mysql_num_rows($result6))
{
$data = mysql_fetch_row($result6);
$sid6 = $data[0];
}

$query7 = “select sid from registration where id = ‘$sid6‘”;
$result7 = mysql_query($query7, $con) or die (mysql_error());
if(mysql_num_rows($result7))
{
$data = mysql_fetch_row($result7);
$sid7 = $data[0];
}

$query8 = “select sid from registration where id = ‘$sid7‘”;
$result8 = mysql_query($query8, $con) or die (mysql_error());
if(mysql_num_rows($result8))
{
$data = mysql_fetch_row($result8);
$sid8 = $data[0];
}

$query9 = “select sid from registration where id = ‘$sid8‘”;
$result9 = mysql_query($query9, $con) or die (mysql_error());
if(mysql_num_rows($result9))
{
$data = mysql_fetch_row($result9);
$sid9 = $data[0];
}

$query10 = “select sid from registration where id = ‘$sid9‘”;
$result10 = mysql_query($query10, $con) or die (mysql_error());
if(mysql_num_rows($result10))
{
$data = mysql_fetch_row($result10);
$sid10 = $data[0];
}

$query11 = “select sid from registration where id = ‘$sid10‘”;
$result11 = mysql_query($query11, $con) or die (mysql_error());
if(mysql_num_rows($result11))
{
$data = mysql_fetch_row($result11);
$sid11 = $data[0];
}

$sid is representing sponsor id

For free videos tutorials, please visitkaushalstreet