Opencart Checkout my sql error


Opencart Checkout my sql error

嗨,每当我们使用bussoc PayPal快速结帐选项时..输入PayPal帐户登录并付款后,会出现一个带有mysql服务器错误的消息,即使客户在付款后回来时也会出现PayPal

注意:错误,您的 SQL 语法有错误 检查与您的 MYSQL 服务器版本对应的手册,了解要使用的正确语法 近顺序 SET customer_id='27' 其中 order_id='279' 在第 1 行

错误号 1064

更新顺序设置为 customer_id='27'其中 order_id='279' 在主页/public_html/站点/系统/数据库/MYSQL 中.php第 49 行这是查询。那么哪里需要改变呢?

<?php
final class MySQL {
private $connection;
public function __construct($hostname, $username, $password, $database) {
    if (!$this->connection = mysql_connect($hostname, $username, $password)) {
        exit('Error: Could not make a database connection using ' . $username . '@' . $hostname);
    }
    if (!mysql_select_db($database, $this->connection)) {
        exit('Error: Could not connect to database ' . $database);
    }
    
    mysql_query("SET NAMES 'utf8'", $this->connection);
    mysql_query("SET CHARACTER SET utf8", $this->connection);
    mysql_query("SET CHARACTER_SET_CONNECTION=utf8", $this->connection);
    mysql_query("SET SQL_MODE = ''", $this->connection);
}
    
public function query($sql) {
    $resource = mysql_query($sql, $this->connection);
    if ($resource) {
        if (is_resource($resource)) {
            $i = 0;
    
            $data = array();
    
            while ($result = mysql_fetch_assoc($resource)) {
                $data[$i] = $result;
    
                $i++;
            }
            
            mysql_free_result($resource);
            
            $query = new stdClass();
            $query->row = isset($data[0]) ? $data[0] : array();
            $query->rows = $data;
            $query->num_rows = $i;
            
            unset($data);
            return $query;  
        } else {
            return true;
        }
    } else {
        trigger_error('Error: ' . mysql_error($this->connection) . '<br />Error No: ' . mysql_errno($this->connection) . '<br />' . $sql);
        exit();
    }
}
public function escape($value) {
    return mysql_real_escape_string($value, $this->connection);
}
public function countAffected() {
    return mysql_affected_rows($this->connection);
}
public function getLastId() {
    return mysql_insert_id($this->connection);
}   
public function __destruct() {
    mysql_close($this->connection);
}
}
?>

您的表名是 order 。这是MySQL中的一个保留关键字。你需要用反引号来逃避它

update `order` 
SET customer_id='27' 
WHERE order_id='279'
update `oc_order` 
SET customer_id='27' 
WHERE order_id='279'

您已为表名添加前缀。当您安装 opencart 时,已添加此前缀。

默认情况下它是"oc_",如果您更改它,请将其替换为