Forums

Post Word Count Plugin SQL Syntax error? (3 posts)

  1. Roar
    Member
    Posted 7 years ago #

    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?

  2. Kafkaesqui
    Moderator
    Posted 7 years ago #

    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

    Now, let's talk about this Sid Caesar fixation... :)

  3. Roar
    Member
    Posted 7 years ago #

    Um, well, see... Sid, me... Oh, never mind.

    *runs away quickly*

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.