MySQLHandler

January 6, 2009
Download
Version 2.1

Description

MySQLHandler is a complete wrapper for MySQL. It implements all functions available and can be easily customized for your preference.

Notice that MySQLHandler is a package of class files and demands higher knowledge of PHP and MySQL. It is not suitable for the beginner, and I will not educate anyone.

Features

When using a SELECT query, the rows can be returned in 3 different formats

  • Standard ResultSet
  • 2-dimensional array
  • XML

Using the XML return method is very usable if you wish to export the results from a query to another application. Using XSLT and CSS you can also present it as a pretty HTML page.

Requirements

  • Runs on both windows and Linux based platforms
  • PHP 5.x
  • MySQL

Installation

Edit the configuration variables in the file called *Database.class.php*

For improved security, place all class files outside the public_html directory.

Usage

The following example will demonstrate how to use the package.

private $server   = 'localhost'; // Server address
private $database = 'database'; // Name of database
private $username = 'user'; // username
private $password = 'pass'; // password
private $use_permanent_connection = false;
private $xslt_file = ''; // Optional XSLT file
private $xml_encoding = 'ISO-8859-1'; // Char-set encoding on XML

You can look through the *Database.class.php* file and read the public functions by yourself to learn more on how to use it.

Updates

Version 2.1

  • Now uses DOM for creating an XML result.
  • ExceptionHandler is now static

Todo

  • Option to log errors to a file
  • Read settings from an XML-file

Did you like this article?

blog comments powered by Disqus