/********************************************************************/
Author: Herve Tribouilloy
Date: 15 october 2005
Purpose: connection layer to MySQL with PHP5.0, using stdClass for basic
container of data. Use of try/catch block allowing handy way to display
error.
/********************************************************************/
/********************************************************************/
Functionality:
The class focus on the readability of the SQL
/********************************************************************/
This class aims to make easy the exchange of data with MySQL
using php.
- The update, insert and delete are handled by a function (setQuery)
- The select query returns an array of stdClass objects (getResult, getRecord)
I tested the class on a full project. In this project,
the connection is only one layer. Validation of the data and
their parsing is handled by other classes.
I suppose everybody has his own way to validate and display the error.
How to use it:
1: setup the database
- open a MySQL console, open the text file db.sav
- the first line create a database test1
- the other line create a table named test_table
2: use the example
- load the page example.php and the class connection.php into a class
folder. The script example.php shows many ways of the use of the class.
/********************************************************************/
|