/** * Conectar ao banco de dados * * @return void * @author Wilker */ protected static function connect() { if (self::$connection !== null) { return; } self::$connection = @mysql_connect(self::$DB_HOST, self::$DB_USER, self::$DB_PASSWORD); if (!self::$connection) { echo '<pre>'; throw new DbConnectionException("Unable to connect to database"); echo '</pre>'; } if (!@mysql_select_db(self::$DB_DATABASE, self::$connection)) { echo '<pre>'; throw new DbConnectionException("Unable to select " . self::$DB_DATABASE . " database"); echo '</pre>'; } }