Title: Database Comment_Approved Error
Last modified: August 18, 2016

---

# Database Comment_Approved Error

 *  [intricateartist](https://wordpress.org/support/users/intricateartist/)
 * (@intricateartist)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/database-comment_approved-error/)
 * On post paging, archives etc, there are sporadic “entries” in my blog that appear
   as WordPress Database Errors.
 * The post container reads:
 * 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‘
   AND comment_approved = ‘1″ at line 1] SELECT COUNT(comment ID) FROM wp_comments
   WHERE comment_post_ID = AND comment_approved = ‘1’;
 * I just noticed this error yesterday. I did upgrade to 1.5.1.3 last week (replaced
   necessary files after backing up same files). I’m no database programmer but 
   I know how to get in there and make adjustments to lines (with help). Can anyone
   help me with this?
 * Thanks in advance!

Viewing 3 replies - 16 through 18 (of 18 total)

[←](https://wordpress.org/support/topic/database-comment_approved-error/?output_format=md)
[1](https://wordpress.org/support/topic/database-comment_approved-error/?output_format=md)
2

 *  [freedomblue](https://wordpress.org/support/users/freedomblue/)
 * (@freedomblue)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/database-comment_approved-error/page/2/#post-232384)
 * i get the same sql error on a fresh install on xampp
 *  [freedomblue](https://wordpress.org/support/users/freedomblue/)
 * (@freedomblue)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-comment_approved-error/page/2/#post-232417)
 * *bump*
 *  [kashirat](https://wordpress.org/support/users/kashirat/)
 * (@kashirat)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/database-comment_approved-error/page/2/#post-232466)
 * Apparently get_posts overwrites the $posts variable.
 * If you surround your sidebar code with
 * $store_posts = $posts;
    //<print top 5 listsings…’
 * $posts = $store_posts
 * That should do it.

Viewing 3 replies - 16 through 18 (of 18 total)

[←](https://wordpress.org/support/topic/database-comment_approved-error/?output_format=md)
[1](https://wordpress.org/support/topic/database-comment_approved-error/?output_format=md)
2

The topic ‘Database Comment_Approved Error’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 18 replies
 * 7 participants
 * Last reply from: [kashirat](https://wordpress.org/support/users/kashirat/)
 * Last activity: [20 years, 6 months ago](https://wordpress.org/support/topic/database-comment_approved-error/page/2/#post-232466)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
