Answer the question
In order to leave comments, you need to log in
Transfusion of users into MLM matrix system?
Good day, I have the following code snippet.
$ref_1 = $_SESSION['ref'];
if ($_SESSION['ref']) {
/*$ref_1 = $_SESSION['ref'];
$ref_lvl = mysqli_fetch_assoc(mysqli_query($db, "SELECT * FROM users WHERE id= $ref_1 "));
$ref_2 = $ref_lvl[ref_1];
$ref_3 = $ref_lvl[ref_2];
$ref_4 = $ref_lvl[ref_3];
$ref_5 = $ref_lvl[ref_4];
$ref_6 = $ref_lvl[ref_5]; */
$ref_slot_1 = mysqli_fetch_assoc(mysqli_query($db, "SELECT ref_slot FROM users WHERE id= $ref_1 "));
$ref_slot_2 = mysqli_fetch_assoc(mysqli_query($db, "SELECT ref_slot FROM users WHERE ref_1 = $ref_1 "));
$ref_slot_3 = mysqli_fetch_assoc(mysqli_query($db, "SELECT ref_slot FROM users WHERE ref_2 = $ref_1 "));
$ref_slot_4 = mysqli_fetch_assoc(mysqli_query($db, "SELECT ref_slot FROM users WHERE ref_3 = $ref_1 "));
$ref_slot_5 = mysqli_fetch_assoc(mysqli_query($db, "SELECT ref_slot FROM users WHERE ref_4 = $ref_1 "));
$ref_slot_6 = mysqli_fetch_assoc(mysqli_query($db, "SELECT ref_slot FROM users WHERE ref_5 = $ref_1 "));
if (ref_slot_1[ref_slot] < 3) {
$ref_1 = $_SESSION['ref'];
$ref_lvl = mysqli_fetch_assoc(mysqli_query($db, "SELECT * FROM users WHERE id= $ref_1 "));
$ref_2 = $ref_lvl[ref_1];
$ref_3 = $ref_lvl[ref_2];
$ref_4 = $ref_lvl[ref_3];
$ref_5 = $ref_lvl[ref_4];
$ref_6 = $ref_lvl[ref_5];
}
if ($ref_slot_1[ref_slot] >= 3) {
if (ref_slot_2[ref_slot] < 3) {
$ref_lvl = mysqli_fetch_assoc(mysqli_query($db, "SELECT * FROM users WHERE id= $_SESSION['ref'] "));
$ref_1 = $ref_lvl[ref_1];
$ref_2 = $_SESSION['ref'];
$ref_3 = $ref_lvl[ref_3];
$ref_4 = $ref_lvl[ref_4];
$ref_5 = $ref_lvl[ref_5];
$ref_6 = $ref_lvl[ref_6];
}
if (ref_slot_2[ref_slot] >= 3) {
if (ref_slot_3[ref_slot] < 3) {
$ref_lvl = mysqli_fetch_assoc(mysqli_query($db, "SELECT * FROM users WHERE id= $_SESSION['ref'] "));
$ref_1 = $ref_lvl[ref_1];
$ref_2 = $ref_lvl[ref_2];
$ref_3 = $ref_lvl[ref_3];
$ref_4 = $ref_lvl[ref_4];
$ref_5 = $ref_lvl[ref_5];
$ref_6 = $ref_lvl[ref_6];
}
}
}
else {
$ref_1 = 1;
$ref_2 = 1;
$ref_3 = 1;
$ref_4 = 1;
$ref_5 = 1;
$ref_6 = 1;
}
Answer the question
In order to leave comments, you need to log in
Look towards PHP processing with recursion . For MLM matrices, recursion is the very thing. You look, and the code will stop smelling so strongly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question