A database class making use of PDO for MySQL written in PHP
1.Designed with a focus on Singleton Pattern for minimal memory usage and to avoid unecessary new connections to the database
2.Supports binding to safeguard against SQL injection
3.Supports Transactions. Transactions allows you to run multiple changes to a database all in one batch
4.Contains a set of helper methods
5.Full support for PHP 5.6/7.x
single()
- Return a single record
resultSet()
- Return an array containing multiple record
rowCount()
- Return The number of rows affected by the last SQL statement
lastInsertId()
- Returns the ID of the last inserted row (Id is the primary key of that table)
beginTransaction()
- Start a transaction
commitTransaction()
- Make a transaction permanent(i.e commit to the database)
debugDumpParams()
- Dumps the the information that was contained in the prepared statement(useful for debugging)
CloseConnection()
- Close the database connection
1.Edit the config.php to add the appropriate database configuration
2.Include config.php
and database.class.php
to the PHP page where you want to use the class.
TODO