// Load userid
list($ref) = SQL_FETCHROW($result);
} else {
- // No entry found
- $ref = 0;
+ // So do we have a userid?
+ $result2 = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`='%s' LIMIT 1",
+ array($ref), __FILE__, __LINE__);
+
+ // Do we have an entry?
+ if (SQL_NUMROWS($result2) == 0) {
+ // No entry, so no referal id
+ $ref = 0;
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result2);
}
// Free result