<?php
// RadioPanel -  Database class
// (C) Matt Ribbins - matt@mattyribbo.co.uk
// 
class Database {
	var $conn;
	var $database;
	
	protected $_config;
	
	public function __construct($config) {
		$this->_config = $config;	
	}

	public function connect() {
		$this->conn = mysql_connect($this->_config['host'], $this->_config['username'], $this->_config['password']);
		if(!$this->conn) {
			echo "<span style=\"color: red\">Error: Cannot connect to MySQL server. ".mysql_error()."</span><br />";
			return false;
		}
		mysql_select_db($this->_config['database']);

		return true;
	}

	public function query($sql, $associative=false) {
		mysql_select_db($this->database);
		$result = mysql_query($sql, $this->conn) or die(mysql_error());

		if($associative) return mysql_fetch_assoc($result);

		return $result;
	}

	public function disconnect() {
		mysql_close($this->conn);
		return;
	}
}
?>
<?php
// RadioPanel -  Database class
// (C) Matt Ribbins - matt@mattyribbo.co.uk
// 
class Database {
	var $conn;
	var $database;
	
	protected $_config;
	
	public function __construct($config) {
		$this->_config = $config;	
	}

	public function connect() {
		$this->conn = new mysqli($this->_config['host'], $this->_config['username'], $this->_config['password'], $this->_config['database']);
		
		if ($this->conn->connect_error) {
			trigger_error('Database connection failed: ' . $this->conn->connect_error, E_USER_ERROR);
			return false;
		}
		return true;
	}

	public function query($sql, $associative=false) {
		$result = $this->conn->query($sql);

		if($associative) return mysql_fetch_assoc($result);

		return $result;
	}

	public function disconnect() {
		$this->conn->close();
		return;
	}
}
?>
Update DB to use PHP MySQLi extensions
Update DB to use PHP MySQLi extensions

class.db.php has been updated to utilise MySQLi extenstions (as I should
be using)
