XF 2.0 How to connect to other database in Xf2

Paul R

Active member
Hi everybody
I'm looking for a way to connect to another database from the xenforo (laravel framework) to get the news in this database to show it on the xenforo widget.
But I do not know the best way to connect to the database .
Let me know if xenforo 2 supports it? Or do I have to create the mysqli_connect () command?
Many thanks all ^^
 
PHP:
$db = new \XF\Db\Mysqli\Adapter([
    'host' => '127.0.0.1',
    'port' => 3306,
    'username' => 'username',
    'password' => 'password',
    'dbname' => 'dbname'
], true);

The true argument indicates wether or not it is a full unicode compatible database.
 
PHP:
$db = new \XF\Db\Mysqli\Adapter([
    'host' => '127.0.0.1',
    'port' => 3306,
    'username' => 'username',
    'password' => 'password',
    'dbname' => 'dbname'
], true);

The true argument indicates wether or not it is a full unicode compatible database.
Thanks @Chris D
Please help me the demo select query with this database connect^^
 
Hi guys,

Just wondering if it is possible to configure this for two databases. Assuming a setup is done so there are two identical databases on two different remote servers, is is possible to configure Xenforo to use a remote database with failover?

Thanks.
 
Back
Top Bottom