Помощь Проблема с опциями: Notice: Error: You have an error in your SQL syntax; check the manual that corre

ihos

Участник
Регистрация
13 Май 2012
Сообщения
213
Реакции
3
Добавляю новую опцию в опенкарт 2.1.0.2
нажимаю сохранить и мне выбивает ошибку
Код:
Notice: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option ORDER BY option_id DESC LIMIT 1' at line 1
Error No: 1064
SELECT option_id AS id FROM option ORDER BY option_id DESC LIMIT 1 in путь/system/library/db/mysqli.php on line 41
Notice: Trying to get property of non-object in путь/system/storage/modification/admin/model/setting/setting.php on line 6
Warning: Cannot modify header information - headers already sent by (output started at путь/admin/index.php:89) in путь/system/library/response.php on line 12

по пути путь/system/storage/modification/admin/model/setting/setting.php on line 6
public function getLastId($code){
$query = $this->db->query("SELECT " . $code . "_id AS id FROM " . DB_PREFIX . $code . " ORDER BY " . $code . "_id DESC LIMIT 1");
$id = $query->row['id']; - 6 строка!!!!
return $id;
}


Пересмотрел базу. Все стандартные поля, заменил файлы
admin/view/template/catalog/option_form.tpl
admin/view/template/catalog/option_list.tpl
admin/controller/catalog/option.php

Но это ничего не помогло
 
Ошибка синтаксиса SQL запроса. На выполнение в БД отправляется некорректный запрос.
Замени метод getLastId() на:
PHP:
public function getLastId($code){
    $q = "SELECT " . $code . "_id AS id FROM " . DB_PREFIX . $code . " ORDER BY " . $code . "_id DESC LIMIT 1";
    $this->log->write('getLastId_query: ' . $q);
    $query = $this->db->query($q);
    $id = $query->row['id'];
    return $id;
}
И лог полного sql запроса в студию
 
Назад
Сверху