Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Erackron
Erackron / dbhandler.php
Last active December 18, 2015 12:58
This is a simple MySQL database handler in PHP using PDO. The default database type used is MySQL, but this can be changed by making the following changes: 1: Update the default port number on line 28. 2: Update the DSN on line 30 to reflect the database system used. 3: Change the SQL query on line 44 to the equivalent of the SQL query to select…
<?php
/**
* @author Jorai Rijsdijk
* @desc A simple MySQL database handler in PHP using PDO.
* @version 1.3
* Note:
* The default database type used is MySQL, but this can be changed by making the following changes:
* 1: Update the default port number on line 28 (constructor).
* 2: Update the DSN on line 30 (new PDO object) to reflect the database system used.
* 3: Change the SQL query on line 44 (in the setDB function) to the equivalent of the SQL query to select a different database.