Ok that's it I am never letting you view my code over teamviewer again.
PHP Code:class Database
{
private $kernel;
private $_dbInfo;
private $db;
public function __construct( Kernel $kernel )
{
$this->kernel = $kernel;
$this->_startDbConn();
}
private function _startDbConn()
{
# Grab the configuration info
global $mysql;
$this->_dbInfo = $mysql;
unset( $mysql );
$class = ( strtolower( $this->_dbInfo[ 'driver' ] ) === 'mysqli' ) ? 'clientMySQLi' : 'clientMySQL' ;
$this->kernel->loadClass( $class, $class . '.php', '/Database' );
$this->db = $this->kernel->getClass( $class );
$this->db->connect( $this->_dbInfo );
$this->kernel->setClass( 'db', $this->db );
//print_r($this->_dbInfo);
}
}
PHP Code:class clientMySQL
{
private $kernel;
private $_conn;
public function __construct( $kernel )
{
$this->kernel = $kernel;
}
public function connect( $sql )
{
$persistent = ( $sql[ 'persistent' ] === 1 ) ? 'mysql_pconnect' : 'mysql_connect';
$host = ( isset( $sql[ 'port' ] ) === true and ctype_digit( $sql[ 'port' ] ) === true ) ? $sql[ 'hostname' ] . ':' . $sql[ 'port' ] : $sql[ 'hostname' ];
$this->_conn = @$persistent( $host, $sql[ 'username' ], $sql[ 'password' ] );
if( $this->_conn === false ) {
errHandler::mysqlError( mysql_errno() );
}
}
}

