Select the Database
db( string $database_name )
Once you have established a connection, you can then select the database you wish to use. Please note, the db() method may not be used by all extensions (ie SQLite and Firebird). To select a database in MySQL we would use:
1 |
DB::MySQL()->db('myDatabase'); |
Note, we can do all of the above in one step!
1 2 3 |
DB::MySQL()->connect('host', 'username', 'password') ->saveConnectionAs('conn1') ->db('myDatabase'); |
DB::DBAL takes advantage of method daisy chaining to allow you to write your queries in as little code possible!