任何帮助将不胜感激
我在关于我的一个网站的 php 错误日志中收到此错误。我实际上有另一个设置完全相同但没有错误的站点....
我真的迷失了这个
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 '' at line 1 for query SELECT * FROM wp_cat_banners where cat_id= made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/telegraph-wp-3-1/single.php'), get_header, locate_template, load_template, require_once('/themes/telegraph-wp-3-1/header.php')
这是我的代码....
<?
global $wpdb;
$cat_ID = get_query_var('cat');
if($cat_ID!="")
{
$parent_id=get_top_parent_category((int) $cat_ID);
}
$sql2 = "SELECT * FROM wp_cat_banners where cat_id=$parent_id";
$cc=$wpdb->get_row($sql2, 'ARRAY_A');
$background=$cc['Background_image'];
if($background !="")
{
?>
<?
global $wpdb;
if(is_front_page() || is_page())
{
$sql2 = "SELECT * FROM wp_cat_banners_home where Id=1";
$cc=$wpdb->get_row($sql2, 'ARRAY_A');
$right_banner5=$cc['Right_banner5'];
if($right_banner5!="")
{
?>
<div id="bannerHead1"><?php echo $right_banner5; ?></div>
<?php
}
}
else
{
if(is_single())
{
$categories= get_the_category();
$cat_ID=$categories[0]->cat_ID;
}
else
{
$cat_ID = get_query_var('cat');
}
if($cat_ID!="")
{
$parent_id=get_top_parent_category((int) $cat_ID);
$sql2 = "SELECT * FROM wp_cat_banners where cat_id=$parent_id";
$cc=$wpdb->get_row($sql2, 'ARRAY_A');
$right_banner5=$cc['Right_banner5'];
if($right_banner5!="")
{
?>