Skip to content

Conversation

@ilyagory
Copy link
Contributor

@ilyagory ilyagory commented Jun 26, 2017

Ability to use multiple connections.

How to use it

  1. create a mysqlidb instance with params for the 1st database
$db = new MysqliDB($host, $username, $password);
  1. add params for the 2nd database (via addConnection method)
$db->addConnection('second', ['host'=>$host2, 'username'=>$username2, 'password'=>$password2]);
  1. switch to the 2nd connection for the next query via connection
$db->connection('second')->get('seconddb_table');

... or the 1st connection will be used

$db->get('firstdb_table');

ps.: selected connection (step 3) will be unselect after request done (at reset method).

@avbdr avbdr merged commit 4dff067 into ThingEngineer:master Jul 4, 2017
@avbdr
Copy link
Collaborator

avbdr commented Jul 4, 2017

Thank you! Merged

ricwein pushed a commit to ricwein/PHP-MySQLi-Database-Class that referenced this pull request Aug 29, 2017
* muliple mysqli connections

* addConnection at constructor

* increase vars

* remove unused connection credentials; tableExists and getSubQuery use selected connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants