<?php
//You may want to change ini_set to the path of your PEAR installation.
//ini_set("include_path",ini_get("include_path").":/var/www/html/PEAR/");
//SET CONFIGURATIONS ACCORDINGLY
$_conf["db_username"] = "root";
$_conf["db_password"] = "";
$_conf["db_host"] = "localhost";
$_conf["db_name"] = "my_table";
$_conf["db_type"] = "mysql";
//Include required files
require_once 'DB.php';
require_once 'dataclass.inc';
//Set up DB connection
$dsn = $_conf["db_type"]."://".$_conf["db_username"].":".$_conf["db_password"]."@".$_conf["db_host"]."/".$_conf["db_name"];
$options = array(
'debug' => 2,
'portability' => DB_PORTABILITY_ALL,
);
$db =& DB::connect($dsn, $options);
if (PEAR::isError($db)) {
die($db->getMessage());
}
//IMPORTANT! PEAR DB's fetchmode MUST BE SET TO OBJECT!
$db->setFetchMode(DB_FETCHMODE_OBJECT);
?>
|