<?php
/**
* 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
require_once('class.Error.php');
require_once('class.Database.php');
#create a db object
$db1 = new CachedDB();
$db2 = new CachedDB();
#select all records from users
$sql = "SELECT * FROM users";
$db1->query($sql);
print_r($db2->get_all($sql));
#finally, show posible errors...
echo $db2->getErrors();
?>
|