• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Connect to our new Database

#1
Hi All,

I just tried to create new Database
In Documentation, we can create use forge (createDatabase Method)
[/url]

Quote:Creating and Dropping Databases
$forge->createDatabase(‘db_name’)
Permits you to create the database specified in the first parameter. Returns TRUE/FALSE based on success or failure


I was succesfully created Database, but when i want to switch database with forge

Quote:Load the Forge Class as follows:
You can also pass another database group name to the DB Forge loader, in case the database you want to manage isn’t the default one:
$this->myforge = \Config\Database::forge('other_db');
And give me error


Quote:$this->myforge = \Config\Database::forge('new_other_db');

ERROR WARNING
InvalidArgumentException
'new_other_db' is not a valid database connection group. [url=https://www.google.com/search?q=InvalidArgumentException+new_other_db+is+not+a+valid+database+connection+group.]
It describe that is not a valid database connection group and we must declare in config/database


But in my case, I want to create new database and connect it directly after we createDatabase with forge
Which way I can do that?


Regards,

A ik
Reply

#2
It goes but your database settings in Config/Database.php group default.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.