Title: Database error?
Last modified: August 18, 2016

---

# Database error?

 *  [wallflower03](https://wordpress.org/support/users/wallflower03/)
 * (@wallflower03)
 * [21 years, 7 months ago](https://wordpress.org/support/topic/database-error-2/)
 * >  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’;
 * It says this on the index page of my blog where the content (of blog entry) is
   supposed to appear. I was wondering which part went wrong. I’d really appreciate
   it if anyone could help me out with this.
    Also, I would like to know where can
   I find the default templates. Thank you.

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

 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [21 years, 7 months ago](https://wordpress.org/support/topic/database-error-2/#post-101868)
 * If the blog you mean is the one linked from your name, then everything now looks
   sweet.
    Default templates ? Not sure what you mean ?
 *  Anonymous
 * [21 years, 7 months ago](https://wordpress.org/support/topic/database-error-2/#post-101908)
 * What causes this kind of error message anyway? I get the following message as
   an admin when I try to view a post with a future timestamp. Note that after the
   SQL errors, it finally gives the correct plain-language error message.
    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 3] SELECT
   category_id, cat_name, category_nicename, category_description, category_parent
   FROM wp_categories, wp_post2cat WHERE wp_post2cat.category_id = cat_ID AND wp_post2cat.
   post_id = Warning: Invalid argument supplied for foreach() in /home/homecome/
   public_html/weblog/wp-includes/template-functions-category.php on line 65 Sorry,
   no posts matched your criteria. Like a 404 message, I also get it when I type
   in a bad URL: [http://homecomers.org/weblog/index.php/archives/2004/9](http://homecomers.org/weblog/index.php/archives/2004/9)
   instead of [http://homecomers.org/weblog/index.php/archives/2004/10](http://homecomers.org/weblog/index.php/archives/2004/10)(
   my blog started in October so there are no September entries).
 *  [Michael McGinnis](https://wordpress.org/support/users/mdmcginn/)
 * (@mdmcginn)
 * [21 years, 7 months ago](https://wordpress.org/support/topic/database-error-2/#post-102065)
 * Well, I guess something I did today fixed the problem. Now when I try to access
   a non-existent page, or one that is dated for the future, I get the simple “Sorry,
   no posts matched your criteria.”

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

The topic ‘Database error?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 4 participants
 * Last reply from: [Michael McGinnis](https://wordpress.org/support/users/mdmcginn/)
 * Last activity: [21 years, 7 months ago](https://wordpress.org/support/topic/database-error-2/#post-102065)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
