Skip to content

A database class making use of PDO for MySQL written in PHP

License

Notifications You must be signed in to change notification settings

khavishbhundoo/mysql-pdo-class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mysql-pdo-class

A database class making use of PDO for MySQL written in PHP

Features

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

Methods

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

How To

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.

Example

TODO

About

A database class making use of PDO for MySQL written in PHP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages