Title: [Plugin: GD Star Rating] SQL Syntax Error
Last modified: August 19, 2016

---

# [Plugin: GD Star Rating] SQL Syntax Error

 *  [sibble](https://wordpress.org/support/users/sibble/)
 * (@sibble)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/)
 * First, the plug-in works fine for me (from what I see). However, looking at my
   server’s error log I see this:
 * `[Mon Dec 08 12:08:26 2008] [error] [client **.***.***.***] 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 p.id as post_id, p.post_title as title, p.post_type, p.post_date,
   d.*, 1 as counter, 0 as votes, 0 as voters, 0 as rating, 0 as bayesian, '' as
   item_trend_rating, '' as item_trend_voting, '' as permalink, '' as tense, '' 
   as rating_stars, '' as bayesian_stars, '' as review_stars from wp_posts p, wp_gdsr_data_article
   d where p.id = d.post_id and p.post_status = 'publish' order by (d.user_votes
   + d.visitor_votes)/(d.user_voters + d.visitor_voters) desc limit 0, made by prepare_data`
 * I’m not sure what this error means, nor do I know what causes it (sorry.) Argument
   could be that maybe this error isn’t caused by the plug-in. So I deactivated 
   the plug-in, and have yet to see this error again.

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [Milan Petrovic](https://wordpress.org/support/users/gdragon/)
 * (@gdragon)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920718)
 * Well, this query is almost 100% correct. There is a value missing at the end 
   with Limi 0, part. Also, this query is generated either by the shortcode or widget.
   Only rating is not the problem. Maybe you have set shortcode or widgewt right?
 * Can you tell me what mySQL version you use, and also can you check if all tables
   are created correctly. Also, give me the settings you used for wudget or shortcode.
 *  Thread Starter [sibble](https://wordpress.org/support/users/sibble/)
 * (@sibble)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920826)
 * Hey GDragoN,
 * I’m using MySQL – 5.0.66
 * I believe some of the other plug-ins I have activated are using shortcode, yes.
   Maybe there could be a conflict with another plug-in?
 * I should have tested using the default WordPress theme, I usually always do this,
   I guess I forgot to. It may be because of the theme I’m using, or other active
   plug-ins. Let me do some testing and I’ll be back with more information. Thanks
   for the help! 😉
 * Jeff
 *  [Milan Petrovic](https://wordpress.org/support/users/gdragon/)
 * (@gdragon)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920839)
 * OK, but as I said query from the first post is missing limit value and that’s
   why it fails. This can happen if you used shortcode or widget with Number Of 
   Posts not set. Default is 10, but it can be also empty.
 * Check that also, and you can give me the url to the web you are testing so I 
   could take a look.
 * Regards,
    Milan
 *  Thread Starter [sibble](https://wordpress.org/support/users/sibble/)
 * (@sibble)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920849)
 * Milan,
 * I’m trying to look to see where the Number of Posts setting is.
    [http://www.sibble.com](http://www.sibble.com)
   is the website.
 * Thanks,
    Jeff
 *  [Milan Petrovic](https://wordpress.org/support/users/gdragon/)
 * (@gdragon)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920854)
 * Voting is working fine, but there is no shortcode used as I can see.
 * It depends on how you add shortcode. If you use editor plugin (red star button),
   it will generate the code for you. Default is 10 posts, and if you don’t change
   it, everything should be fine. If you change it you only need to add some other
   valid numbered value, and not to leave that empty.
 * Regards,
    Milan
 *  Thread Starter [sibble](https://wordpress.org/support/users/sibble/)
 * (@sibble)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920856)
 * Milan,
 * Yea I re-activated the plug-in almost 2 hours ago and I haven’t seen the error
   in my logs yet.
 * Thanks for taking a look and your help!
 * Jeff
 *  Thread Starter [sibble](https://wordpress.org/support/users/sibble/)
 * (@sibble)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920860)
 * Milan,
 * OK, sorry you’re right it was the widgets. I added both GD Blog Rating and GD
   Star Rating widgets and I got several different errors added in my log. Excuse
   the spam, the errors look different to me so I just want to show them to you 
   🙂
 *     ```
       [Tue Dec 09 12:23:20 2008] [error] [client 216.64.75.194] 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 ' count(*) as count, 0 as rating, 0 as bayes_rating, 0 as max_rating, 0 as percen' at line 1 for query select , count(*) as count, 0 as rating, 0 as bayes_rating, 0 as max_rating, 0 as percentage from wp_posts p, wp_gdsr_data_article d where p.id = d.post_id and p.post_status = 'publish' made by prepare_blog_rating
   
       [Tue Dec 09 12:23:20 2008] [error] [client 216.64.75.194] 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 p.id as post_id, p.post_title as title, p.post_type, p.post_date, d.*, 1 as counter, 0 as votes, 0 as voters, 0 as rating, 0 as bayesian, '' as item_trend_rating, '' as item_trend_voting, '' as permalink, '' as tense, '' as rating_stars, '' as bayesian_stars, '' as review_stars from wp_posts p, wp_gdsr_data_article d where p.id = d.post_id and p.post_status = 'publish' order by p.id desc limit 0, made by prepare_data
       ```
   
 * Jeff
 *  Thread Starter [sibble](https://wordpress.org/support/users/sibble/)
 * (@sibble)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920868)
 * The widget specifically causing these errors is the GD Blog Rating widget. I 
   deactivated the specific widget it and the errors stopped again.
 * Also, more new errors (might be helpful)
    `[Tue Dec 09 13:37:05 2008] [error][
   client 168.215.220.66] PHP Warning: include(STARRATING_PATHiepngfix.htc) [<a 
   href='function.include'>function.include</a>]: failed to open stream: No such
   file or directory in /wp-content/plugins/gd-star-rating/iepngfix/iepngfix.php
   on line 7`
 * `[Tue Dec 09 13:37:05 2008] [error] [client 168.215.220.66] PHP Warning: include()[
   <a href='function.include'>function.include</a>]: Failed opening 'STARRATING_PATHiepngfix.
   htc' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /wp-content/
   plugins/gd-star-rating/iepngfix/iepngfix.php on line 7`
 * `[Tue Dec 09 13:37:05 2008] [error] [client 168.215.220.66] PHP Notice: Use of
   undefined constant STARRATING_PATH - assumed 'STARRATING_PATH' in /wp-content/
   plugins/gd-star-rating/iepngfix/iepngfix.php on line 7, referer: http://www.google.
   com/search?hl=en&q=x61+wireless&aq=f&oq=`
 * `[Tue Dec 09 13:37:05 2008] [error] [client 168.215.220.66] PHP Warning: include(
   STARRATING_PATHiepngfix.htc) [<a href='function.include'>function.include</a>]:
   failed to open stream: No such file or directory in /wp-content/plugins/gd-star-
   rating/iepngfix/iepngfix.php on line 7, referer: http://www.google.com/search?
   hl=en&q=x61+wireless&aq=f&oq=`
 * `[Tue Dec 09 13:37:05 2008] [error] [client 168.215.220.66] PHP Warning: include()[
   <a href='function.include'>function.include</a>]: Failed opening 'STARRATING_PATHiepngfix.
   htc' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /wp-content/
   plugins/gd-star-rating/iepngfix/iepngfix.php on line 7, referer: http://www.google.
   com/search?hl=en&q=x61+wireless&aq=f&oq=`
 * Jeff
 *  Thread Starter [sibble](https://wordpress.org/support/users/sibble/)
 * (@sibble)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920869)
 * I guess that’s all the same error because it’s referring to the same file, same
   line.
 *  [Milan Petrovic](https://wordpress.org/support/users/gdragon/)
 * (@gdragon)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920881)
 * Yes this is definitly a bug. You can disable IE6 PNG Fix, and this will go away.
   I will fix it for the next release.
 * As for the previous post with the SQL problem, this is due to the bad settings
   with both widgets. Can you post a screenshot on how did you set widgets exactly,
   with all settings for both widgets visible? When I see this, I can tell you what
   the problem is.
 *  Thread Starter [sibble](https://wordpress.org/support/users/sibble/)
 * (@sibble)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920922)
 * Hey Milan,
 * I can not reproduce the previous SQL errors, and now the Blog widget is working
   correctly. I disabled IE6 PNG Fix, I’m now not getting any errors what-so-ever.
   Also, I’m using all default settings for the widgets.
 * Jeff
 *  [Milan Petrovic](https://wordpress.org/support/users/gdragon/)
 * (@gdragon)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920931)
 * Great to hear that. In any case I will ad some failsafe code to prevent using
   incorect values, and avoid future problems if something are not set right.
 * Regards,
    Milan

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘[Plugin: GD Star Rating] SQL Syntax Error’ is closed to new replies.

## Tags

 * [SQL syntax error](https://wordpress.org/support/topic-tag/sql-syntax-error/)

 * 12 replies
 * 2 participants
 * Last reply from: [Milan Petrovic](https://wordpress.org/support/users/gdragon/)
 * Last activity: [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-gd-star-rating-sql-syntax-error/#post-920931)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
