WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using a plugin that failed after upgrade to wp3.2.

The error log shows:

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 post_id, meta_value, post_status FROM bxxoai_postmeta LEFT JOIN bxxoai_posts ON post_id=bxxoai_posts.ID WHERE post_status='publish' AND meta_key='wpfp_favorites' AND meta_value > 0 ORDER BY ROUND(meta_value) DESC LIMIT 0, made by require, require_once, include, get_header, locate_template, load_template, require_once, get_sidebar, locate_template, load_template, require_once, wpfp_widget_view, wpfp_list_most_favorited

mysql version I used is 5.0.92-community

I'm clueless with database, can anyone please teach or help explain to me what needed to be done to fix this?

share|improve this question
What plugin caused this error? – tollmanz Jul 11 '11 at 3:47
wp-favorite-post, only specific to how it handles the query to get the most favorited list – Sean Lee Jul 12 '11 at 8:50
up vote 1 down vote accepted

I ran into this as well... I am using the SQL query, but not the wpfp_list_most_favorited() function, so this may or may not work for you, but worth a shot. Try updating the SQL query in wp-favorite-posts.php (around line 206) from:

$query = "SELECT post_id, meta_value, post_status FROM $wpdb->postmeta";


$query = "SELECT post_id, meta_value, meta_key, post_status FROM $wpdb->postmeta";

Hope this helps!

share|improve this answer
only upvoted before, now the checkmark. Thank you. – Sean Lee Aug 2 '11 at 8:06

If you can log in to your WP Admin, remove the plugin from there. Otherwise, go through FTP and remove the offending plugin through wp/wp-content/plugins/

After removing, your site should run properly without the error.

share|improve this answer
thanks but no thanks. My question is specific to need sql syntax help, not to dump the plugin completely. – Sean Lee Jul 12 '11 at 8:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.