【问题标题】:WooCommerce Database ErrorsWooCommerce 数据库错误
【发布时间】:2016-02-26 16:54:07
【问题描述】:

我的 Wordpress/WooCommerce 安装后端报告了一个错误。我几乎没有使用 SQL 的经验,所以我不知道从哪里开始解决这个问题。

具体来说,我有一个名为 Query Monitor 的插件,它会提醒后端中的某些页面正在产生 DB 错误。其中最成问题的是显示重复错误的编辑产品屏幕。报错如下:

查询

SELECT postmeta.post_id AS product_id 
FROM wp_postmeta AS postmeta 
LEFT JOIN wp_posts AS products
ON ( products.ID = postmeta.post_id ) 
WHERE postmeta.meta_key LIKE 'attribute_%' 
AND postmeta.meta_value = 'uk-10' 
AND products.post_parent =

调用堆栈

display_price_in_variation_option_name()
apply_filters('woocommerce_variation_option_name')
WC_Meta_Box_Product_Data::output_variations()
WC_Meta_Box_Product_Data::output()
do_meta_boxes()

组件

Plugin: woocommerce

错误

You have an error in your SQL syntax; 
check the manual that corresponds to your MariaDB server 
version for the right syntax to use near '' at line 6

这是我的某个主题文件中的问题,还是我需要仔细查看数据库?

非常感谢任何帮助!

【问题讨论】:

    标签: php mysql wordpress woocommerce


    【解决方案1】:

    你错过了哪里的价值,(最后一个)

    WHERE postmeta.meta_key LIKE 'attribute_%' 
    AND postmeta.meta_value = 'uk-10' 
    AND products.post_parent = ""
                                ^// here
    

    【讨论】:

    • 谢谢 - 这完全有道理。那段代码将位于哪里?在我假设的模板文件之一中?
    • 我不是来自 wordpress 背景。刚刚看到mysql错误,发现了错误。
    • 谢谢。我会看看该代码是从哪里提取的:)
    猜你喜欢
    • 1970-01-01
    • 2018-11-07
    • 1970-01-01
    • 2016-01-15
    • 2018-07-26
    • 2015-06-25
    • 1970-01-01
    • 2015-10-07
    • 2014-02-28
    相关资源
    最近更新 更多