Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.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
Php WordPress插件数据库错误您的SQL语法有错误_Php_Mysql_Database_Wordpress - Fatal编程技术网

Php WordPress插件数据库错误您的SQL语法有错误

Php WordPress插件数据库错误您的SQL语法有错误,php,mysql,database,wordpress,Php,Mysql,Database,Wordpress,每次加载页面时,我都会多次收到此消息。 [07-Jul-2018 17:30:49 UTC]WordPress数据库错误您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以了解第6行的near'和p.post_status='publish''用于查询选择计数(*)的正确语法 [07-Jul-2018 17:30:49 UTC] WordPress database error You have an error in your SQL syntax; check the

每次加载页面时,我都会多次收到此消息。 [07-Jul-2018 17:30:49 UTC]WordPress数据库错误您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以了解第6行的near'和p.post_status='publish''用于查询选择计数(*)的正确语法

    [07-Jul-2018 17:30:49 UTC] WordPress database 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 'AND p.post_status='publish'' at line 6 for query SELECT count(*) FROM wp_posts p
INNER JOIN wp_term_relationships tr ON tr.object_id = p.ID
INNER JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
INNER JOIN wp_geo_mashup_location_relationships gmlr ON gmlr.object_id = p.ID AND gmlr.object_name = 'post'
WHERE tt.term_id =
AND p.post_status='publish' made by require('wp-blog-header.php'),
require_once('wp-includes/template-loader.php'),
include('/themes/hestia-child/front-page.php'),
get_footer, locate_template, load_template,
require_once('/themes/hestia-child/footer.php'),
do_action('hestia_do_footer_child'),
WP_Hook->do_action, WP_Hook->apply_filters,
call_user_func_array, hestia_the_footer_content_child,
dynamic_sidebar, call_user_func_array, WP_Widget->display_callback,
WP_Widget_Categories->widget, wp_dropdown_categories,
walk_category_dropdown_tree, call_user_func_array, Walker->walk, Walker->display_element,
call_user_func_array, Walker_CategoryDropdown->start_el, apply_filters('list_cats'),
WP_Hook->apply_filters, call_user_func_array, GeoMashup::list_cats, GeoMashupDB::category_located_post_count
我想这会导致GeoMashup的“geo mashup db.php”(复制如下)的一部分,我读到了一些关于ID/ID之间大小写不匹配的信息,这些信息可能会导致这种情况,但我似乎找不到任何实例。任何帮助或建议都会很好

* Get the number of located posts in a category.
*
* @since 1.2
*
* @param id $category_id
* @return int
*/
public static function category_located_post_count( $category_id ) {
global $wpdb;

$select_string = "SELECT count(*) FROM {$wpdb->posts} p
INNER JOIN {$wpdb->term_relationships} tr ON tr.object_id = p.ID
INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
INNER JOIN {$wpdb->prefix}geo_mashup_location_relationships gmlr ON gmlr.object_id = p.ID AND gmlr.object_name = 'post'
WHERE tt.term_id = " . esc_sql( $category_id ) ."
AND p.post_status='publish'";
return $wpdb->get_var( $select_string );
}

/**
* Get categories that contain located objects.
*
* Not sufficient - probably want parent categories.
*
* @return array Located category id, name, slug, description, and parent id
*/
private static function get_located_categories() {
global $wpdb;

$select_string = "SELECT DISTINCT t.term_id, t.name, t.slug, tt.description, tt.parent
FROM {$wpdb->prefix}geo_mashup_location_relationships gmlr
INNER JOIN {$wpdb->term_relationships} tr ON tr.object_id = gmlr.object_id
INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
INNER JOIN {$wpdb->terms} t ON t.term_id = tt.term_id
WHERE tt.taxonomy='category'
ORDER BY t.slug ASC";
return $wpdb->get_results( $select_string );
}

一篇老文章,但值得一提的是:问题在于Geo Mashup的小部件选项“自动”为类别创建地图链接(管理>模糊设置)。

所有类别中的所有帖子都必须保存所有
GeoMeta
la
t、
lng
geo address
和保存的名称),否则您将经常遇到此错误。

取消选中
将地图链接添加到类别列表
将停止错误。
按名称/ID映射类别的快捷码和模板标记仍然可以正常工作

希望这能帮助别人