1
我想使用CodeIgniter和DBForge來創建一個多租戶應用程序。我將在中央數據庫中創建一個「用戶」表,用於存儲用戶的名稱和數據庫的名稱。PHP CodeIgniter每個用戶一個數據庫
我遇到的問題是創建個人數據庫和他們的表。這裏的代碼片段:沒有任何問題,創建
if ($this->dbforge->create_database($db_name))
{
echo 'Database created!';
// an array of fields
$fields = array(
'name' => array(
'type' => 'VARCHAR',
'constraint' => '100',
),
);
// set them up for the new table
$this->dbforge->add_field($fields);
// create the new table in the new db
$this->dbforge->create_table('items');
}
數據庫$ DB_NAME但是當我創建表「項目」,這是對我的中央數據庫中創建這不是我想要的。
謝謝umefarooq - 這是完美的,正在做我所需要的! – Robl
比請接受這個答案並向上 – umefarooq