WordPress.org

Ready to get started?Download WordPress

Forums

Comment error: "Unknown colum 'ID' in 'where clause' (2 posts)

  1. justinbaeder
    Member
    Posted 8 years ago #

    Every time a comment is left on my site, the user gets an error that says:
    WordPress database error: [Unknown column 'ID' in 'where clause']
    SELECT * FROM wp_comments WHERE ID = '25161'

    WordPress database error: [Unknown column 'ID' in 'where clause']
    UPDATE wp_comments SET comment_content = '' WHERE ID = '25161'

    To see for yourself, leave a comment here.

    The comment goes through OK, but the user has to hit "back" and refresh the page to see his/her comment. Very annoying. I've posted on this here and here, but I still don't know the source of the problem or how to fix it.

    I've upgraded to wp2.0, replacing all of my core WP files, and I've tried other themes (including Kubrick), so I know it's not a problem with any of the WP core files or my theme. It must be a database problem, but I'm not sure what to make of the database - everything looks the same as my sites that are working.

    So here's my question: What line of what file is generating the query that throws this error? The address bar says I'm in wp-comments-post.php when the error is displayed, so that's my best guess. wp-comments-post.php contains this line:
    $status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");

    If I'm understanding correctly, this is fetching the comment status and post status from the wp_posts table in the database, to determine which message to display (e.g. "your comment is in moderation," etc.) upon returning the user to the individual archive page. However, this doesn't happen because of the error.

    If that's not the code that's generating the error, what else could it be?

    If that is the code, what's wrong with my database?

    By the way, if I use PHPMyAdmin to run this query manually:
    SELECT * FROM wp_comments WHERE ID = '25161'
    I don't get an error - it returns the data it's supposed to.

    Any suggestions would be greatly appreciated. Let me know if it would help to provide other info about my database or anything else. Thanks.

  2. justinbaeder
    Member
    Posted 8 years ago #

    Problem solved, thanks to d0ngle: The plugin Scripturizer Remix is to blame for this error. Deactivating it caused the error to vanish.

Topic Closed

This topic has been closed to new replies.

About this Topic