Multiple mySQL database connections in PHP

As I am working on my hobby project Wigbi, I am making it possible to create multiple instances of the DatabaseHandler class, to make it possible to work with multiple databases.

However, as I shut down one connection, I noticed that all connections were closed. When I investigated the issue further, I realized that even though I created multiple connections, I only had one.

So, why did I only receive one single connection, although I created multiple ones? The answer lies in the fourth parameter that is sent to the mysql_connect function. If this is not set to true, multiple connections will not be allowed.

Advertisements