-while (list($lvl, $per) = SQL_FETCHROW($result_depths)) {
- // Initialize ref-count
- $REFS = 0;
-
- // Load referral points
- $result_points = SQL_QUERY_ESC("SELECT points, locked_points FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s AND ref_depth=%d LIMIT 1", array($GLOBALS['userid'], bigintval($lvl)), __FILE__, __LINE__);
+while ($data = SQL_FETCHARRAY($result_depths)) {
+ // Merge it together
+ $content = merge_array($content, $data);
+
+ // Initialize array elements
+ $content['counter'] = '0';
+ $content['points'] = '0.00000';
+ $content['locked_points'] = '0.00000';
+
+ // Load referal points
+ $result_points = SQL_QUERY_ESC("SELECT `points`, `locked_points` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1",
+ array(
+ getMemberId(),
+ bigintval($content['level'])
+ ), __FILE__, __LINE__);
+
+ // Do we have an entry?