Answer the question
In order to leave comments, you need to log in
How to connect another database?
Tried connecting another database via settings.php and here is the result >
Fatal error: Class 'RulesEventHandlerEntityBundle' not found in D:\OpenServer\domains\Test2\sites\all\modules\rules\modules\node.rules.inc on line 147
help :)
Answer the question
In order to leave comments, you need to log in
In settings.php add a new entry to the standard "default" array, for example it is "database2":
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'users',
'username' => 'root',
'password' => '',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
'database2' =>
array (
'database' => 'database',
'username' => 'root',
'password' => '',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);
$import = db_select('field_data_etc', 't', array('target' => 'database2'))
->fields('t', array('field_data_etc_value'))
->condition('t.field_data_etc', 'value')
->condition('t.field_data_etc2', 'value2')
->execute()
->fetchAssoc();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question