dsoy71058 2010-10-23 18:12
浏览 29
已采纳

mysqli php扩展

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,$password);

      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.....

  • 写回答

1条回答 默认 最新

  • douzhuo8312 2010-10-23 18:17
    关注

    Try $this->error (it's a property, not a function in OO style). See also the examples at the php manual

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥30 用arduino开发esp32控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题