Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
分析错误:语法错误,意外的T_ELSE,第54行的/home/petit/public_html/system/database/mysqli.php中需要T_函数_Php_Mysqli - Fatal编程技术网

分析错误:语法错误,意外的T_ELSE,第54行的/home/petit/public_html/system/database/mysqli.php中需要T_函数

分析错误:语法错误,意外的T_ELSE,第54行的/home/petit/public_html/system/database/mysqli.php中需要T_函数,php,mysqli,Php,Mysqli,我已将opencart从一台服务器传输到另一台服务器,并出现以下错误 分析错误:语法错误,意外的T_ELSE,第54行的/home/petit/public_html/system/database/mysqli.php中需要T_函数 当我尝试访问我的站点或管理员页面时。 知道为什么会这样吗? 我已经一步一步地按照程序进行了 这是mysqli.php <?php final class MySQLi { private $mysqli; public function

我已将opencart从一台服务器传输到另一台服务器,并出现以下错误 分析错误:语法错误,意外的T_ELSE,第54行的/home/petit/public_html/system/database/mysqli.php中需要T_函数

当我尝试访问我的站点或管理员页面时。 知道为什么会这样吗? 我已经一步一步地按照程序进行了

这是mysqli.php

 <?php
final class MySQLi {
    private $mysqli;

    public function __construct($hostname, $username, $password, $database) {
        $this->mysqli = new mysqli($hostname, $username, $password, $database);

        if ($this->mysqli->connect_error) {
            trigger_error('Error: Could not make a database link (' . $this->mysqli->connect_errno . ') ' . $this->mysqli->connect_error);
        }

        $this->mysqli->query("SET NAMES 'utf8'");
        $this->mysqli->query("SET CHARACTER SET utf8");
        $this->mysqli->query("SET CHARACTER_SET_CONNECTION=utf8");
        $this->mysqli->query("SET SQL_MODE = ''");
    }

    public function query($sql) {
        $result = $this->mysqli->query($sql);



        if ($this->mysqli->errno) {
        //$mysqli->errno
        }

            if (is_resource($resource)) {
                $i = 0;

                $data = array();

                while ($row = $result->fetch_object()) {
                    $data[$i] = $row;

                    $i++;
                }

                $result->close();

                $query = new stdClass();
                $query->row = isset($data[0]) ? $data[0] : array();
                $query->rows = $data;
                $query->num_rows = $result->num_rows;

                unset($data);




                return $query;  
            } else {
                return true;
            }
        } else {
            trigger_error('Error: ' . mysql_error($this->link) . '<br />Error No: ' . mysql_errno($this->link) . '<br />' . $sql);
            exit();
        }
    }

    public function escape($value) {
        return $this->mysqli->real_escape_string($value);
    }

    public function countAffected() {
        return $this->mysqli->affected_rows;
    }

    public function getLastId() {
        return $this->mysqli->insert_id;
    }   

    public function __destruct() {
        $this->mysqli->close();
    }
}
?>


提前谢谢你

如果有其他没有的话。如果块关闭,则显示
。做得像-

if ($this->mysqli->errno) {
//$mysqli->errno

    if (is_resource($resource)) {
        $i = 0;

        $data = array();

        while ($row = $result->fetch_object()) {
            $data[$i] = $row;

            $i++;
        }

        $result->close();

        $query = new stdClass();
        $query->row = isset($data[0]) ? $data[0] : array();
        $query->rows = $data;
        $query->num_rows = $result->num_rows;

        unset($data);




        return $query;  
    } else {
        return true;
    }
} else {
    trigger_error('Error: ' . mysql_error($this->link) . '<br />Error No: ' . mysql_errno($this->link) . '<br />' . $sql);
    exit();
}
if($this->mysqli->errno){
//$mysqli->errno
如果(是_资源($resource)){
$i=0;
$data=array();
而($row=$result->fetch_object()){
$data[$i]=$row;
$i++;
}
$result->close();
$query=new stdClass();
$query->row=isset($data[0])?$data[0]:数组();
$query->rows=$data;
$query->num\u rows=$result->num\u rows;
未结算(数据);
返回$query;
}否则{
返回true;
}
}否则{
触发器错误('error:'.mysql\u error($this->link)。'
错误号:'.mysql\u errno($this->link)。'
。$sql); 退出(); }
使用IDE匹配
{
花括号
}
大括号,使用不同的缩进样式。欢迎…如果答案已解决,请接受。