mysql - SQL语法限制1个错误

标签 mysql sql wordpress limit

WordPress 数据库错误

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 'LIMIT 1' at line 4

查询

SELECT wp_wpsp_templates_fonts.name
  FROM wp_wpsp_templates_fonts
  WHERE wp_wpsp_templates_fonts.fontID = 
  LIMIT 1

制作者

require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentyten/wpsp-sales-page.php'), require_once('/plugins/wpsp/wpsp-frontend.php'), TemplatesModel->GetFontByID

下面是代码。

    function GetFontByID($fontID) {
    global $wpdb;

    $results = $wpdb->get_results(" SELECT ".$wpdb->prefix."wpsp_templates_fonts.name
                                    FROM ".$wpdb->prefix."wpsp_templates_fonts
                                    WHERE ".$wpdb->prefix."wpsp_templates_fonts.fontID = ".mysql_real_escape_string($fontID)."
                                    LIMIT 1");
    return $results[0]->name;    
}

关于如何解决此问题有什么想法吗?

最佳答案

GetFontByID() 需要传递一个参数。目前,该参数显示为空白。

关于mysql - SQL语法限制1个错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19393682/

相关文章:

javascript - 如何使用 Selenium Python 在 WordPress 帖子中上传文件?

java - MySQLSyntaxErrorException 神秘

java - 找不到适合 mysql 的驱动程序(远程调试)

mysql - SQL 不会将查询排队到链接服务器

sql - 检查约束 - 在此上下文中不允许子查询

sql - 如何获取有关 Oracle 中索引和表所有者的信息?

c# - 如何将两个表连接成一个新表以在 C# 中显示?

在 jenkinsfile 中找不到 mysqldump

python - Wordpress xmlrpc SSL 证书错误(仅在 1 台机器上)

html - header 上的未知样式