vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   multiple databases question (https://vborg.vbsupport.ru/showthread.php?t=186704)

c4smok 07-30-2008 12:59 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..

Thanks for reading, looking for a clean way to do this like a plugin on start or something.

Thank you for your time,
c4smok

Dismounted 07-30-2008 06:50 AM

As long as the MySQL user for vBulletin has access to the other database, you can use the standard MySQL "database.table" syntax.
[sql]SELECT *
FROM database1.tableA[/sql]

c4smok 07-30-2008 10:19 PM

I seem to be getting a database error for the forum system when I try to use that.


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 I made based on your advice which I may not be doing correctly. The user for both databases have the same access also.

Code:

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

The Error msg
Code:

Invalid SQL:

    SELECT *
    FROM `mysite_database2.table_servusers`
    WHERE `username` = 'c4smok'
    LIMIT 1;

MySQL Error  : Incorrect table name 'mysite_database2.table_servusers
Error Number  : 1103

Thanks for your time again,
c4smok

MoT3rror 07-31-2008 03:11 AM

Try mysite_database2.table_servusers with the `.

c4smok 07-31-2008 03:41 AM

its working =)

your great

thanks,
c4


All times are GMT. The time now is 05:04 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00975 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete