Database
The IssuesPHP Framework allows you to connect to up to 12 different databases using PDO; let's look at some examples.
Multiple database connections
In the `Database.php` file, there is a default connection; if the `DB_NUMBER` constant is left empty or assigned the value 1, it connects to a default database.
define('DB_HOST', 'localhost');
define('DB_USERNAME', 'jonathan');
define('DB_PASSWORD', '123');
define('DB_DATABASE', 'apruebas');
define('DB_DRIVER', 'mysql');
define('DB_NUMBER', '');
Connecting a second database:
define('DB_SECOND_HOST', 'localhost');
define('DB_SECOND_USERNAME', 'jonathan');
define('DB_SECOND_PASSWORD', '123');
define('DB_SECOND_DATABASE', 'hudemyx');
define('DB_SECOND_DRIVER', 'mysql');
define('DB_SECOND_NUMBER', '2');
This allows you to run queries across up to 12 different MySQL databases; now, let's see how to execute queries.