2017-05-23 1 views
0

Drupalの8: 私は(PHPMyAdminの上に位置し)、外部データベースに接続するフォームモジュールの作成に取り掛かるするか疑問ではなく、よDrupal 8データベース。私はむしろDrupalの新人であり、私のために働くかもしれないそのような例を見つけることができませんでした。どのようにDrupalのフォームのモジュールを作成しない外部のデータベースに接続し

ご迷惑をおかけして申し訳ありません。 この質問は、Drupal 8固有のものです。あなたのモジュールファイルでのsettings.php

$databases = array(); 
$databases['default']['default'] = array(
    // Drupal's default credentials here. 
    // This is where the Drupal core will store its data. 
); 
$databases['my_other_db']['default'] = array(
// Your secondary database's credentials here. 
// You will be able to explicitly connect to this database from you 
    modules. 
); 

+0

可能な重複[挿入を使用してDBにフォームの内容を提出したDrupalの\ _write \ _record](https://stackoverflow.com /質問/ 12317031/insert-submitted-form-content-to-db-using-drupal-write-record) – Picard

+0

私の質問はDrupal 8に関するものであり、以前の質問バージョン、変更前。 – Jay1995

答えて

1

db_set_active('my_other_db'); 
    // Run queries 
    // Change back to your DB 
    db_set_active(); 
関連する問題