MyBB Community Forums

Full Version: bbDB class connect(...)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Would be nice if you can add the optional parameter [bool new_link] to the connect function by default.
What do you need it for?

If you want to use multiple connections then you create a new instance of the class:

$db2 = new bbDB;

$db2->connect() etc.
yes but at my new convertor script i use 2 db class connected to same host (localhost) same user but different database. The second class connection makes the first unusable.

So I need to use a third party class to do this currently, because its afaik not allowed to publish changed myBB files.
It won't if you define it as a new class.

You can have $db and $db2 running at the same time - infact that's what i'm doing at the moment for a plugin which will allow me to manage the new MyBB site via these forums.

$site_db = new bbDB;
$site_db->connect("localhost", "username, "password", 0);
$site_db->select_db("mybb_site");


That is the code i'm using - so i've got 2 databases open at the same time, $db for MyBB and $site_db for the MyBB site.
This is the same I do - but I get the error (access first) :

mySQL error: 1146
Table 'db1.mybb_posts' doesn't exist
Query: TRUNCATE TABLE mybb_posts;

If the second class is connected. If second isn't connected the error doesn't exist. I only can fix this if I add new_link = true to the connections.

Currently I'm not sure if the db connections can be limited by mysql config, php or apache, so it's runs on some servers and on others it wont run.