User Tools

Site Tools


php:database

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

php:database [2008/04/29 12:43] (current)
Line 1: Line 1:
 +{{keywords>​php class database mysql query value row array insert update delete}} ​
 +====== ImpactClub PHP Database ======
 +{{php:​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 =====
 +  * 1.0 stable (23/​02/​2005) -- {{php:​database.1.0.zip|}}
 +  * 1.1 RC -- available soon
 +
 +===== How to use =====
 +
 +**Database configuration**
 +<code php>
 +$config['​database'​]['​host'​]='​localhost';​
 +$config['​database'​]['​username'​]='​username';​
 +$config['​database'​]['​password'​]='​password';​
 +$config['​database'​]['​dbname'​]='​database_name';​
 +</​code>​
 +
 +**Database connection**
 +<code php>
 +global $database;
 +$database = new CDatabase();​
 +</​code>​
 +
 +**Query**
 +<code php>
 +$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
 +</​code>​
php/database.txt ยท Last modified: 2008/04/29 12:43 (external edit)