Welcome Guest, Not a member yet? Register   Sign In
connection without db selection
#1

[eluser]Unknown[/eluser]
hi,

is it possible to connect to mysql server, but not selecting a db

I need this to create a database with an user that has no databases created in mysql
of course different from mysql_connect Smile

thanks
#2

[eluser]danmontgomery[/eluser]
http://ellislab.com/codeigniter/user-gui...forge.html
#3

[eluser]Unknown[/eluser]
Important: In order to initialize the Forge class, your database driver must already be running, since the forge class relies on it.

so it needs to be connected to use dataforge ... the connection is made with the normal database default connection, or is it another way?

dataforge contains functions to manipulate dbs, adding and dropping stuff. I need a way connection without db selection.
#4

[eluser]Basketcasesoftware[/eluser]
noctrum apparently just responded to the part of your question "need to create a database". The answer to your question is you do not need to supply a database name in your configuration in order to get the engine running. That item is optional and needs to be documented as such. I just spent hours researching and experimenting on that issue (and found a CodeIgniter documentation error in the process).

1. Create your database configuration either in an array or use the database.php configuration file. Simply leave the value of the database name key as an empty string.
2. Load the database object.
3. Load the database forge object.
4. Optionally load the database helper object.
5. Then it's simple a call to $this->dbforge->create_database('db_name'); //Substitute your database name for
'db_name'.




Theme © iAndrew 2016 - Forum software by © MyBB