public static function connectToRealmDB($realmid) { self::selectDB('webdb'); if ($GLOBALS['realms'][$realmid]['mysql_host'] != $GLOBALS['connection']['host'] || $GLOBALS['realms'][$realmid]['mysql_user'] != $GLOBALS['connection']['user'] || $GLOBALS['realms'][$realmid]['mysql_pass'] != $GLOBALS['connection']['password']) { mysql_connect($GLOBALS['realms'][$realmid]['mysql_host'], $GLOBALS['realms'][$realmid]['mysql_user'], $GLOBALS['realms'][$realmid]['mysql_pass']) or buildError("<b>Database Connection error:</b> A connection could not be established to Realm. Error: " . mysql_error(), NULL); } else { self::connectToDB(); } mysql_select_db($GLOBALS['realms'][$realmid]['chardb']) or buildError("<b>Database Selection error:</b> The realm database could not be selected. Error: " . mysql_error(), NULL); self::$connectedTo = 'chardb'; }