diff options
Diffstat (limited to 'code/db.inc.php')
-rw-r--r-- | code/db.inc.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/code/db.inc.php b/code/db.inc.php index 3f5c444..d46b5cd 100644 --- a/code/db.inc.php +++ b/code/db.inc.php @@ -6,16 +6,26 @@ include('adodb.inc.php'); - $conn = ADONewConnection($config['driver']); - $conn->PConnect($config['server'], $config['user'], $config['password'], $config['db']); - function DBQuery($query, $args = null) { - $sql = $GLOBALS['conn']->Prepare($query); - return $GLOBALS['conn']->Execute($sql, $args); + class DB { + var $conn; + + function DB($driver, $server, $user, $passwort, $database) { + $this->conn = ADONewConnection($driver); + $this->conn->PConnect($server, $user, $passwort, $database); + } + + function Query($query, $args = null) { + $sql = $this->conn->Prepare($query); + return $this->conn->Execute($sql, $args); + } + + function InsertID() { + return $this->conn->Insert_ID(); + } } - function DBInsertID() { - return $GLOBALS['conn']->Insert_ID(); - } + $db = new DB($config['driver'], $config['server'], $config['user'], + $config['password'], $config['db']); } ?> |