PHP Classes

File: example-cached_db.php

Recommend this page to a friend!
  Classes of marcelo entraigas  >  Simple DB  >  example-cached_db.php  >  Download  
File: example-cached_db.php
Role: Example script
Content type: text/plain
Description: cached db example
Class: Simple DB
Store and retrieve data from a MySQL database
Author: By
Last change: Accessible without user login
Date: 13 years ago
Size: 729 bytes


Class file image Download
  * This is an advanced example of using the Database class

    # default database configuration
$cfg_resource['default'] = array(
'server' => 'localhost',
'database' => 'tradeaxes',
'user' => 'tradeaxes',
'pass' => 'tradeaxes',
'cache_ttl' => 300,
'cache_path' => '',
'cache_prefix' => 'db_',

#main includes

#create a db object
$db1 = new CachedDB();
$db2 = new CachedDB();
#select all records from users
$sql = "SELECT * FROM users";
#finally, show posible errors...
echo $db2->getErrors();