I'm using the following code to connect to my Database - PHP7 to MySQL
You are using object, which creates connection in constructor. You will have as many connections as instances of
database will be created.
If you create
database instance, set it to some variable and use connection from this instance - there will be only one connection.
If you are creating
database instance for each query - there will be many connections.