WordPress MySQL SQL询问错误在WPDB类

WordPress插入用户或外部剧本开发商在MySQL数据库时也许遇到问题在,当设法通过使用$wpdb类进行询问或操作,作用类为根据ezSQL的所有数据库操作。 $wpdb Wordpress类在PHP提供容易的方法访问对数据库表,不用需要再手工编码数据库连接句法。 $wpdb在数据库提供几个作用给通入,检索,选择,删除,更新或者操作数据例如询问, get_var, get_row、get_col、get_results、逃命、show_errors、hide_errors, get_col_info和充足。 当使用这$wpdb解析SQL声明和在插入或外部剧本甚至Wordpress代码时以下错误或相似的错误也许出现。

WordPress数据库错误: [您有一个错误在您的SQL句法; 检查对应于您的MySQL服务器版本为正确的句法于近用途‘由post_date ASC极限1预定’在线1]的指南
选择ID、post_title从wp_posts, post_date >”并且post_date <'2006-08-28 09:03:57' AND post_status='publish' AND ID !="ORDER" BY post_date ASC LIMIT 1

或(以下从bsuite B2V6)

WordPress数据库错误: [您有一个错误在您的SQL句法; 检查对应于您的MySQL服务器版本为正确的句法于近用途’ s呼叫’左的指南(b.post_title, 60)末端作为标题,总和(a.hits_reads)作为sor’在线4]
选择a.post_id作为post_id,案件,当b.post_title是空然后`阿丽斯的家庭’左(b.post_title, 60)时末端作为标题,总和(a.hits_reads)作为sort_order, CONCAT (’小孩: `格式(总和(a.hits_reads), 0), `Avg : `格式((总和(a.hits_reads)) /((TO_DAYS (现在())
- TO_DAYS (分钟(a.bstat_date))) + 1), 0), `最大: `、格式(MAX (a.hits_reads), 0), `’)作为笔记从wp_bstat_hits左边由a.post_id命令加入wp_posts b在(a.post_id = b.ID) bstat_date > `2006-08-03 ′小组由sort_order DESC极限5的地方

一错误的原因是由代表Wordpress岗位的ID的post_ID或ID可变物造成的。 根据PHP的哪个版本、MySQL或者WordPress您使用了, $post_id或$id或者$post->ID可以在单引号之内被安置(’)作为解决方法或决议避免或解决错误。

重要: 这是现状提供,不用保单的机器翻译的页。 计算机翻译也许是难了解。 参见 原始的英国文章 每当可能。

分享并且贡献或者得到技术支持并且帮助在 我的数字式生活论坛.



One Response to “WordPress MySQL SQL Query Error in WPDB Class”

  1. casey bisson
    April 16th, 2007 22:11
    1

    I’ve let these errors persist for way too long, but now they’re fixed along with a bunch of other bugs.

    The latest version also lays the groundwork to transition to bsuite3, a ground-up rewrite and re-architecting of the plugin.

    http://maisonbisson.com/blog/post/11613/

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting


Custom Search

New Articles

Incoming Search Terms for the Article

"mysql error with query" - wordpress sql query - wpdb error - wordpress wpdb - $db->query wordpress - wordpress query database - max sql syntax - $wp_result = $wp->query($wp_query); - $wpdb - wordpress mysql class - "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" - some error in query You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax - how to format sum syntax in mysql - wpdb wordpress - SQL=You have an error in your SQL syntax; check the manual that corresponds to your MySQL - wordpress wpdb order by - $wpdb->query mysql error - mysql check query error - 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 '=VALUE' at line 1 - query wordpress - wordpress query - how can i use my database query in wordpress - MySQL server version for the right syntax to use near 'LENGTH(code) DESC' at line 2 - windows 2003 you have an error in your sql syntax; check the manual - wordpress slow sql post - $wpdb errors - Mysql::Error: #42000 BLOB/TEXT column 'title' used in key specification without a key length: - MySQL server version for the right syntax to use near 'AND (post_status IN - MYSQL error SUM - SQL=You have an error in your SQL syntax; check the manual that corresponds to your MyS - wpdb->query 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 \'ASC limit 0,1\' at line 1 - check the manual that corresponds to your MySQL server version for the right syntax to use near ') and status != 'DELETED' - How to solve WordPress database error? - mysql 5 max length on sql query - update query to change from dat to datetime mysql - wordpress database connection outside server - mysql php5 sql-query (select max - wordpress wpdb check 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 's ' WHERE Seriennummer - Could not retrieve article info; 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 - MySQL server version for the right syntax to use near 'SET id='' WHERE id = ''' at line 1 - Script line: 4 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 8 - wordpress database error delete post WHERE post_id - wordpress $wpdb->query update not working - error check function in sql query - how to use custom specification order by class in the mysql - how to execute sql query with wordpress - MySQL error with query - ORDER BY wordpress mysql -