/**
* Program : dbconnect.php
* Description : Wrapper for ADODB
* Programmer : Samson Chung
* Creation Date : May 29th, 2k7
* Full Description : Allows easier control over ADODB's functions
*
* Copyright (c) 2007 by Samson Chung
*/
include("./lib/adodb/adodb.inc.php");
class dbconnect {
private $con;
private $values = array();
private $iterator;
private $numRows;
function dbconnect(){
global $dsn, $usr, $pwd, $schema, $dbConnectionType;
$this->iterator = 0;
$this->numRows = 0;
//echo "dsn:[$dsn] usr:[$usr] pwd:[$pwd]";
//echo "schema:[$schema] dbConnectionType:[$dbConnectionType]";
$this->con = NewADOConnection($dbConnectionType);
$this->con->Connect($dsn, $usr, $pwd, $schema);
//$this->con->SetFetchMode(ADODB_FETCH_ASSOC);
}
function prepforSQL($unsafeSQL_Insert){
$safeSQL = $this->con->qstr($unsafeSQL_Insert);
return $safeSQL;
}
function query($query){
$this->close();
$this->dbconnect();
$returned = $this->con->EXECUTE($query);
$temp = array();
//echo "returned->_numOfRows:[" . $returned->_numOfRows. "]";
if ($returned->_numOfRows > 0){
$temp = $returned->GetArray();
$this->numRows = $returned->_numOfRows;
}
$lowerArray = array();
for ($i = 0; $i < sizeof($temp); $i++){
$individualRecord = $temp[$i];
$loweredIndividualRecord = array();
//print_r($individualRecord);
foreach ($individualRecord as $key => $value){
$key = strtolower($key);
$loweredIndividualRecord[$key] = $value;
$lowerArray[$i] = $loweredIndividualRecord;
}
}
$this->values = $lowerArray;
}
function f($find){
$returned = "";
if (sizeof($this->values) > 0){
$find = strtolower($find);
$returned = $this->values[$this->iterator][$find];
}
return $returned;
}
function has_element(){
$return = false;
if (sizeof($this->values) > 0){
$return = true;
}
return $return;
}
function num_rows(){
return sizeof($this->values);
}
function next_record(){
$ok = true;
if (($this->iterator + 1) > (sizeof($this->values) - 1)){
$ok = false;
} else {
$this->iterator = $this->iterator + 1;
}
return $ok;
}
function close(){
$this->con->close();
}
}
?>
Fatal error: Cannot declare class sessionhandler, because the name is already in use in /home/chungs/jr_groves/lib/sessionhandler.php on line 12