【问题标题】:Unexpected Token issues when trying to run SQL query for zencart尝试为 zencart 运行 SQL 查询时出现意外的令牌问题
【发布时间】:2018-07-23 07:43:29
【问题描述】:

我对此很陌生,我正在尝试在插件中运行以下查询 - Add Pages to More Information Sidebox

有人看到我看不到的吗? PHPmyadmin 在以下三个查询中都显示了许多 Unexpected token 问题!

Unexpected Tokens

查询 #1:

insert into configuration (configuration_title, configuration_key, configuration_value, 
configuration_description, configuration_group_id, sort_order, last_modified, date_added, 
use_function, set_function) values ('Define Page 5', 'DEFINE_PAGE_5_STATUS', '1', 'Enable 
the Defined Page 5 Link/Text?<br />0= Link ON, Define Text OFF<br />1= Link ON, Define 
Text ON<br />2= Link OFF, Define Text ON<br />3= Link OFF, Define Text OFF', '25', '85', 
now(), now(), NULL, 'zen_cfg_select_option(array(\'0\', \'1\', \'2\', \'3\'),');

查询 #2:

insert into configuration (configuration_title, configuration_key, configuration_value, 
configuration_description, configuration_group_id, sort_order, last_modified, date_added, 
use_function, set_function) values ('Define Page 6', 'DEFINE_PAGE_6_STATUS', '1', 'Enable 
the Defined Page 6 Link/Text?<br />0= Link ON, Define Text OFF<br />1= Link ON, Define 
Text ON<br />2= Link OFF, Define Text ON<br />3= Link OFF, Define Text OFF', '25', '85', 
now(), now(), NULL, 'zen_cfg_select_option(array(\'0\', \'1\', \'2\', \'3\'),');

查询 #3:

insert into configuration (configuration_title, configuration_key, configuration_value, 
    configuration_description, configuration_group_id, sort_order, last_modified, date_added, 
    use_function, set_function) values ('Define Page 7', 'DEFINE_PAGE_7_STATUS', '1', 'Enable 
    the Defined Page 7 Link/Text?<br />0= Link ON, Define Text OFF<br />1= Link ON, Define 
    Text ON<br />2= Link OFF, Define Text ON<br />3= Link OFF, Define Text OFF', '25', '85', 
    now(), now(), NULL, 'zen_cfg_select_option(array(\'0\', \'1\', \'2\', \'3\'),');

一定有一些我看不到的东西,但我又是新手! 提前感谢您的任何帮助和/或指导!

【问题讨论】:

  • 不确定,因为查询看起来不错。尝试使用没有 set_function 的查询(从 INSERT 中删除最后一列及其值。看看这是否可以解决。

标签: mysql sql phpmyadmin zen-cart


【解决方案1】:

问题出在INSERT语句最后插入数据zen_cfg_select_option

你应该'zen_cfg_select_option(array(\'0\', \'1\', \'2\', \'3\'),') 插入'zen_cfg_select_option(array(\'0\', \'1\', \'2\', \'3\'))'

顺便说一句,下次你可能会在你的sql语句上设置排版,也许你会发现问题。

查询 1

insert into configuration 
(
    configuration_title, 
    configuration_key, 
    configuration_value, 
    configuration_description, 
    configuration_group_id, 
    sort_order, 
    last_modified, 
    date_added, 
    use_function, 
    set_function
) 
values 
(
    'Define Page 5', 
    'DEFINE_PAGE_5_STATUS', 
    '1', 
    'Enable the Defined Page 5 Link/Text?<br />0= Link ON, Define Text OFF<br />1= Link ON, Define Text ON<br />2= Link OFF, Define Text ON<br />3= Link OFF, Define Text OFF',
    '25',
    '85', 
    now(), 
    now(), 
    NULL, 
    'zen_cfg_select_option(array(\'0\', \'1\', \'2\', \'3\')'
);

查询 2

INSERT INTO configuration 
(
    configuration_title, 
    configuration_key, 
    configuration_value, 
    configuration_description, 
    configuration_group_id, 
    sort_order, 
    last_modified, 
    date_added, 
    use_function, 
    set_function
) 
VALUES 
(
    'Define Page 6', 
    'DEFINE_PAGE_6_STATUS', 
    '1', 
    'Enable the Defined Page 6 Link/Text?<br />0= Link ON, Define Text OFF<br />1= Link ON, Define Text ON<br />2= Link OFF, Define Text ON<br />3= Link OFF, Define Text OFF',
    '25', 
    '85', 
    now(), 
    now(), 
    NULL, 
    'zen_cfg_select_option(array(\'0\', \'1\', \'2\', \'3\')'
);

查询 3

INSERT INTO configuration 
(
    configuration_title, 
    configuration_key, 
    configuration_value, 
    configuration_description, 
    configuration_group_id, 
    sort_order, 
    last_modified, 
    date_added, 
    use_function, 
    set_function
) 
VALUES 
(
    'Define Page 7', 
    'DEFINE_PAGE_7_STATUS', 
    '1', 
    'Enable the Defined Page 7 Link/Text?<br />0= Link ON, Define Text OFF<br />1= Link ON, Define Text ON<br />2= Link OFF, Define Text ON<br />3= Link OFF, Define Text OFF', 
    '25', 
    '85', 
    now(), 
    now(),
    NULL, 
    'zen_cfg_select_option(array(\'0\', \'1\', \'2\', \'3\'))'
);

【讨论】:

    【解决方案2】:

    当您在 Zen Cart 管理员中使用 Admin->Tools->Install SQL Patches 导入该文件时,它可以正常工作。人们在 phpMyAdmin 下运行这些脚本时遇到麻烦,因为他们的表有前缀(如“zen_”),管理员导入正确处理但 phpMyAdmin 没有。 (使用 phpMyAdmin,如果您的表有前缀,则必须修改脚本以反映它。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-10
      • 2017-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-21
      • 1970-01-01
      相关资源
      最近更新 更多