Das Fehlerausgabesystem ist Teil des Template-Systems und springt an wenn ein beispielsweise ein DB-Fehler auftritt, deshalb wird das Template-System mit in die DB-Klasse geladen und das Script sofort beendet.
[code=php]
class MySQL {
public $count = 0;
public $error = 'ERROR_SQL';
public $fields = array();
public $linkID = 0;
public $output = '';
public $result = '';
function __construct( $output )
{
$this->setOutput( $output );
}
function setOutput( $output )
{
$this->output = $output;
}
function connect()
{
$this->linkID = @mysql_connect( DB_HOST, DB_USER, DB_PASSWORD );
if ( ! $this->linkID ) {
$this->output->createMessage( $this->error, 'DB_NO_CONNECTION' );
}
}
function errno()
{
return mysql_errno( $this->linkID );
}
function error()
{
return mysql_error( $this->linkID );
}
function start()
{
$this->connect();
$this->selectDatabase();
}
}
$output = new Output( $cfg );
$db = new MySQL( $output );
$db->start();[/code]