Table of Contents

ImpactClub PHP Database

database.jpg DATABASE is a package designed to work in PHP 4.x or 5.x. It can be used freely by anyone in personal or business application, in non commercial way. It represents a general way to database abstraction and standardization.

Download

How to use

Database configuration

$config['database']['host']='localhost';
$config['database']['username']='username';
$config['database']['password']='password';
$config['database']['dbname']='database_name';

Database connection

global $database;
$database = new CDatabase();

Query

$query  = 'SELECT * FROM table WHERE col=condition';
$value  = $database->getValue($query);  // single value
$array  = $database->getRow($query);    // array of values
$matrix = $database->getArrays($query); // array of arrays of values
 
$insert = $database->setInsert($query); // autoincremet id of a INSERT query
$update = $database->setUpdate($query); // update rows number of a UPDATE query
$delete = $database->setDelete($query); // update rows number of a DELETE query