- // Load bonus id
- $result = SQL_QUERY_ESC("SELECT stats_id, bonus_id, link_type FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid`=%s ORDER BY `id`",
- array(bigintval(getRequestElement('userid'))), __FILE__, __LINE__);
- } else {
- // Load stats id (2nd will be ignored later! But it is needed for the same fetchrow command)
- $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid`=%s ORDER BY `id` ASC",
- array(bigintval(getRequestElement('userid'))), __FILE__, __LINE__);
- }
-
- // Get number of rows from the query
- $nums = SQL_NUMROWS($result);
-
- if ($nums > 0) {
+ // Use bonus_id
+ $linkDataName = 'bonus_id';
+ } // END - if
+
+ // Load user links data
+ $result = sqlQueryEscaped("SELECT `userid`, `stats_id`, `%s`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid`=%s ORDER BY `id` ASC",
+ array(
+ $linkDataName,
+ bigintval(getRequestElement('userid'))
+ ), __FILE__, __LINE__);
+
+ // Are there some entries?
+ if (!ifSqlHasZeroNums($result)) {