Introducing The Database Connection Manager
The database connection manager is an excelent tool that can help you to manage database connections for your application / website. This component will store the connection details and conveniently initialize a PDO object to handle queries. This tool offers also full support for the PtQueryBuilder component, if specified as an option when adding a connection.
Main Features:
- Handles multiple database connections
- Full PDO support to handle queries
- Can be used with the PtQueryBuilder class to prepare and execute queries
- Uses the PtcDebug class to log all connections
Getting Started
To start managing your database connections with the connection manager, download the file PtcDb.php from the repository and add a new connection with your database details:
-
require_once( 'PtcDb.php' );
-
(
-
'user' => 'some user' ,
-
'pass' => 'some pass' ,
-
'db' => 'some database name'
-
) );
Lets use our connection with the PtQueryBuilder class for example, to retrieve data from tables:
-
// calling the query builder with the connection manager
-
->select( 'some_column as test' )
-
->run( );
For a complete list of options and examples read the full user guide.