网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   vBulletin技术交流 (https://www.0058.net/forumdisplay.php?f=6)
-   -   multiple databases question (https://www.0058.net/showthread.php?t=4654)

topvip 2014-03-12 06:47 AM

multiple databases question
 
I currently run vbulletin forums with other services linked in to the same database. But it has started to become really hard to manage.. around over 200+ tables..

I was wondering if there was a way I could put my services into another database and still use the plug-in system to have them linked into the forums for all the connections and vars. My current system I have one database with my services in tables of one database..

Here is the method.

As long as the MySQL user for vBulletin has access to the other database, we can use the standard MySQL "database.table" syntax.
Code:

SELECT *
FROM database1.tableA

Here is what we use:

This is the current code I use to bring over vars from other tables in the same database.
Code:

$uservar = $vbulletin->db->query_first("
    SELECT *
    FROM `table_servusers`
    WHERE `username` = '" . $vbulletin->userinfo['username'] . "'
    LIMIT 1
");

This is the changes:
Code:

$uservar = $vbulletin->db->query_first("
    SELECT *
    FROM `mysite_database2.table_servusers` .
    WHERE `username` = '" . $vbulletin->userinfo['username'] . "'
    LIMIT 1
");



All times are GMT +8. The time now is 09:17 PM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.