Ok, you NEED to have that code like I have it here:
PHP Code:
// <!-- TOP REFERRER -->
$ref = $DB_site->query_first("
SELECT COUNT(*) AS referrals, user.username, user.userid
FROM " . TABLE_PREFIX . "user AS users
LEFT JOIN " . TABLE_PREFIX . "user ON (users.referrerid = user.userid)
WHERE users.referrerid <> 0
GROUP BY users.referrerid
ORDER BY referrals DESC
LIMIT 1
");
Don't replace the TABLE_PREFIX with yours. Put this code in the file in place of the one you changed.