mysqli php extend
i was wondering if you could point me in the right direction. Im extending the mysqli class but cant seem to call the error function..
<?php
class mysqli_ls extends mysqli
{
private $activeConnection = 0;
private $linkArr = array();
private $queryArr = array();
private $errorArr = array();
public function __construct()
{
}
/* Connection ************************************************************ */
public function connect($host='', $username='', $password='', $port='', $database='')
{
$no =& $this->activeConnection;
$no++;
if ( empty($host) || empty($username) || empty($password) || empty($port) || empty($database) )
{
$this->setError('1', 'connect','missing required variables');
return false;
}
$this->linkArr[ $no ] = parent::mysqli($host,$username,$pas开发者_如何学编程sword);
if ( $this->linkArr[ $no ] === false )
{
$this->setError(2, 'connect', parent::error( $this->linkArr[ $no ] ) );
return false;
}
return $no;
}
Fatal error: Call to undefined method mysqli::error() in C:\wamp\www\vhdocs\test\mysqli.class.php on line 31
i've also tried parent::mysqli_error and had the same error... I cant see why i cant call the error.....
Try $this->error
(it's a property, not a function in OO style). See also the examples at the php manual
精彩评论