djDBI - A PHP Database InterfaceBy Dag, on December 30th, 2016
A PHP class I wrote for quick and universal MYSQL and MSSQL database handling. I've used it extensively and with small variations it has worked well for both easy DB management as well as debugging.
USAGE * The public methods open() and query() will exit the PHP script * with error messages if a connection cannot be established and/or * if a query returns FALSE. query() will return an associative row * array if a resultset with content was returned, NULL if it's * empty. For other successful SQL statements like INSERT, UPDATE, * DELETE, DROP, etc, query() will return TRUE on success. * * Example of usage: include 'djDBI.php'; $db = new djDBI(); $db->open('localhost', 'database', 'user', 'pass', 'MYSQL'); $result = $db->query("SELECT * FROM testdata"); $db->close(); unset($db); if (!is_null($result)) // Returned an associative array you can loop through.
Updated 2014.3 for MySQLi