Title: Post Word Count Plugin SQL Syntax error?
Last modified: August 18, 2016

---

# Post Word Count Plugin SQL Syntax error?

 *  [Roar](https://wordpress.org/support/users/rori/)
 * (@rori)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/post-word-count-plugin-sql-syntax-error/)
 * I uploaded and activate the post-count.php plugin.
 * I added this code:
    `<?php get_post_count(); ?>` to a page.
 * I get this error on the page at the location where I entered the code above.
 * 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 ‘WHERE
   post_status = ‘publish’ AND post_date < ‘2005-01-31 01:34]
    SELECT COUNT(*) FROM
   WHERE post_status = ‘publish’ AND post_date < ‘2005-01-31 01:34:23’
 * Is this because I am trying to put the plugin on a separate page from all the
   posts?

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

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/post-word-count-plugin-sql-syntax-error/#post-138227)
 * It’s because changes to the plugin are causing problems for it in 1.2.x. For 
   a 1.2 version, copy this over the get_post_count function in the plugin’s file:
 * `function get_post_count() {
    global $wpdb, $tableposts; $request = "SELECT COUNT(*)
   FROM $tableposts WHERE post_status = 'publish'"; echo $wpdb->get_var($request);}
 * Taken from:
    [http://wiki.wordpress.org/Post-Comment%20Stats](http://wiki.wordpress.org/Post-Comment%20Stats)
 * Now, let’s talk about this Sid Caesar fixation… `:)`
 *  Thread Starter [Roar](https://wordpress.org/support/users/rori/)
 * (@rori)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/post-word-count-plugin-sql-syntax-error/#post-138231)
 * Um, well, see… Sid, me… Oh, never mind.
 * *runs away quickly*

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

The topic ‘Post Word Count Plugin SQL Syntax error?’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [Roar](https://wordpress.org/support/users/rori/)
 * Last activity: [21 years, 3 months ago](https://wordpress.org/support/topic/post-word-count-plugin-sql-syntax-error/#post-138231)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
