Hubgoblin Posted January 9, 2007 Share Posted January 9, 2007 Hello, I'm trying to extent mysqli native class and I have the following problems. When I call parent::connect() the function never returns any result and I cannot recieve the connection identifier. Also parent::query() returns true and not a real result. Please tell me what is goin on. I'll post the entire class.[code]<?phpclass SQL extends mysqli{ public $connection; public $statement; public $autocommit = false; public $dbPrefix = null; public function __construct( $params ) { $this->connect($params); } public function connect( $params ) { $this->dbPrefix = isset($params['prefix'])?$params['prefix']:null; @$this->connection = parent::connect ( $params['host'], $params['user'], $params['pass'], $params['base'] ); // !!!!!!!!!!!!!!!!!!!!!!! echo '<pre>';var_dump($this->connection);echo '</pre>'; die(__METHOD__.__FILE__); // Why $this->connection is null) if (mysqli_connect_error()) throw new Exception(mysqli_connect_error()); // managing transactions autommit property parent::autocommit($this->autocommit); /** mysqli pepared statements managing object @var : Object @param : Object @return : Object @example : http://bg.php.net/manual/en/function.mysqli-stmt-prepare.php */ $this->statement =& new mysqli_stmt($this); } public function disconnect() { $this->close($this->connection); } /** Free result @deprecated */ public function free(){} public function prefix() { return $this->dbPrefix; } public function query( $sql ) { if (!($result = parent::query($sql))) { die(sprintf("Can't perform query on database. Error: %s", $this->error)); } return $result; } public function getAll( $sql ) { $res = $this->query($sql); } public function getOne( $sql ) { } public function getLastInsertID() { return mysqli_insert_id(); } public function getRows(){} public function getAffectedRows() { return mysqli_affected_rows(); }}[/code] Link to comment https://forums.phpfreaks.com/topic/33437-class-extension-problem-please-help/ Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 [code]mysqli_stmt($this)[/code]from glancing, that $this looks awfully lonely without a ->var behind it, but i may be wayyy off Link to comment https://forums.phpfreaks.com/topic/33437-class-extension-problem-please-help/#findComment-156539 Share on other sites More sharing options...
Hubgoblin Posted January 9, 2007 Author Share Posted January 9, 2007 This is not the issue that I am asking for :) Link to comment https://forums.phpfreaks.com/topic/33437-class-extension-problem-please-help/#findComment-156555 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.