Title: WordPress database error from graphene_get_comment_count()
Last modified: August 21, 2016

---

# WordPress database error from graphene_get_comment_count()

 *  [J.D. Grimes](https://wordpress.org/support/users/jd55/)
 * (@jd55)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-from-graphene_get_comment_count/)
 * I am getting the following error logged each time I visit the the _Dashboard_
   screen on the administration side of the site:
 *     ```
       [23-Jun-2013 21:12:19 UTC] 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 7 for query
               SELECT
                   COUNT(comment_ID)
               FROM
                   ds_comments
               WHERE
                   comment_type = "" AND comment_approved="1" AND comment_parent="0"  AND
                   comment_post_ID=  made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/graphene/404.php'), get_header, locate_template, load_template, require_once('/themes/graphene/header.php'), wp_head, do_action('wp_head'), call_user_func_array, wp_enqueue_scripts, do_action('wp_enqueue_scripts'), call_user_func_array, graphene_localize_scripts, graphene_get_comment_count
       ```
   
 * This is happening because `graphene_get_comment_count()` uses `get_post_ID()`,
   which won’t work on the admin side. Adding this to the top of the function fixes
   the bug:
 *     ```
       if ( ! get_the_ID() )
             return;
       ```
   
 * Thanks.

Viewing 1 replies (of 1 total)

 *  [phil_trottier](https://wordpress.org/support/users/phil_trottier/)
 * (@phil_trottier)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-from-graphene_get_comment_count/#post-3871870)
 * Same here. This didn’t happen before upgrade to WordPress version 3.5.2 though…
 * Thanks for the fix.
 * I posted in the Graphene forum:
    [http://forum.graphene-theme.com/bug-report/wordpress-database-error-since-upgrading-to-wordpress-352](http://forum.graphene-theme.com/bug-report/wordpress-database-error-since-upgrading-to-wordpress-352)

Viewing 1 replies (of 1 total)

The topic ‘WordPress database error from graphene_get_comment_count()’ is closed
to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/graphene/2.9.4/screenshot.jpg)
 * Graphene
 * [Support Threads](https://wordpress.org/support/theme/graphene/)
 * [Active Topics](https://wordpress.org/support/theme/graphene/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/graphene/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/graphene/reviews/)

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)

 * 1 reply
 * 2 participants
 * Last reply from: [phil_trottier](https://wordpress.org/support/users/phil_trottier/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-from-graphene_get_comment_count/#post-3871870)
 * Status: not resolved