$sqlx = "INSERT INTO tbl_referdata SET parent='{$parent_row}',parent_main='{$parent_row2}',child='{$child_row}',level='{$level}'"; echo "{$sqlx}<br>"; mysql_query("INSERT INTO tbl_referdata SET parent='{$parent_row}',parent_main='{$parent_row2}',child='{$child_row}',level='{$level}'"); } } } return mysql_query($query); } function cronlevel_toedit($data, $level) { $parent = $data['accounts_id']; $level = $level - 1; $query = "SELECT child FROM tbl_referdata WHERE parent='{$parent}' AND level='{$level}'"; return mysql_query($query); } $curlevel = $_GET['level']; $cron1edit = cronlevel_toedit(getUserToCron($curlevel), $curlevel); $userdata = getUserToCron($curlevel); while ($row = mysql_fetch_assoc($cron1edit)) { $child = $row['child']; $data = array(); $data['accounts_id'] = $child; cronlevel_toadd($data, $curlevel, $userdata['accounts_id']); } mysql_query("UPDATE tbl_accounts SET bonus_cron=bonus_cron + 1 WHERE accounts_id='" . $userdata['accounts_id'] . "'"); if ($userdata['accounts_id'] == '') { echo " # "; //do when no accounts related. } else { echo "Processing:" . $userdata['accounts_id']; }
$child_row = $row['child']; if ($parent_row != $child_row && countrows("SELECT id FROM tbl_referdata WHERE parent='{$parent_row}' AND child='{$child_row}'") == 0) { $sqlx = "INSERT INTO tbl_referdata SET parent='{$parent_row}',parent_main='{$parent_row}',child='{$child_row}',level='{$level}'"; echo "{$sqlx}<br>"; mysql_query("INSERT INTO tbl_referdata SET parent='{$parent_row}',parent_main='{$parent_row}',child='{$child_row}',level='{$level}'"); } } } return mysql_query($query); } function cronlevel_toedit($data, $level) { $parent = $data['accounts_id']; $query = "SELECT child FROM tbl_referdata WHERE parent='{$parent}' AND level='{$level}'"; return mysql_query($query); } $curlevel = 1; $cron1add = cronlevel_toadd(getUserToCron(), $curlevel); $cron1edit = cronlevel_toedit(getUserToCron(), $curlevel); $userdata = getUserToCron($curlevel); if (mysql_num_rows($cron1edit) == 0) { echo "No Child for:" . $userdata['accounts_id']; } else { echo "Yes Child for:" . $userdata['accounts_id']; } mysql_query("UPDATE tbl_accounts SET bonus_cron='2' WHERE accounts_id='" . $userdata['accounts_id'] . "'"); if ($userdata['accounts_id'] == '') { echo "hehe"; //do when no accounts related. } else { }