summaryrefslogtreecommitdiffstats
path: root/code/db.inc.php
blob: 5fbd8e8215cd21da91ac739d161080661921b188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?PHP
  if(!defined('DB_INC')) {
    define('DB_INC', 1);
    
    include('config/config.inc.php');
    
    include('adodb.inc.php');
    
    
    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 = false) {
        return $this->conn->Execute($query, $args);
      }
      
      function QueryLimit($query, $numrows = -1, $offset = -1, $args = false) {
      	return $this->conn->SelectLimit($query, $numrows, $offset, $args);
      }
      
      function InsertID() {
        return $this->conn->Insert_ID();
      }
    }
    
    $db = new DB($config['driver'], $config['server'], $config['user'],
                 $config['password'], $config['db']);
  }
?>