summaryrefslogtreecommitdiffstats
path: root/code/db.inc.php
blob: d46b5cd5f4e4616f12b1b9955fbfe96e9413df5f (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
<?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 = null) {
        $sql = $this->conn->Prepare($query);
        return $this->conn->Execute($sql, $args);
      }
      
      function InsertID() {
        return $this->conn->Insert_ID();
      }
    }
    
    $db = new DB($config['driver'], $config['server'], $config['user'],
                 $config['password'], $config['db']);
  }
?>