WordPress.org

Forums

comments, database error, 2.31 upgrade (4 posts)

  1. teros
    Member
    Posted 7 years ago #

    after upgrading to 2.31 i THOUGHT everything was hunky dory until i clicked on comments......then i see the following either above or below the comments (depending on the theme). apparently its not theme specific because i get the same error on the default theme with no customizations.
    ------------------
    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 'p WHERE p.post_date < '2007-02-19 02:52:48' AND p.post_type = 'post' AND p. (wp' at line 1]
    SELECT p.ID, p.post_title FROM (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)) AS p WHERE p.post_date < '2007-02-19 02:52:48' AND p.post_type = 'post' AND p. (wp_posts.post_status = 'publish' OR (wp_posts.post_status = 'private' AND (pl_wp_postmeta.meta_key = 'post_level' AND pl_wp_postmeta.meta_value <= 10 ))) ORDER BY p.post_date DESC LIMIT 1

    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 'p WHERE p.post_date > '2007-02-19 02:52:48' AND p.post_type = 'post' AND p. (wp' at line 1]
    SELECT p.ID, p.post_title FROM (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)) AS p WHERE p.post_date > '2007-02-19 02:52:48' AND p.post_type = 'post' AND p. (wp_posts.post_status = 'publish' OR (wp_posts.post_status = 'private' AND (pl_wp_postmeta.meta_key = 'post_level' AND pl_wp_postmeta.meta_value <= 10 ))) AND p.ID != 54 ORDER BY p.post_date ASC LIMIT 1

    any help would be appreciated.

  2. teros
    Member
    Posted 7 years ago #

    oops, upon further review it seemsm that this may be related to the "post levels" plugin - i'll check the creators website for help.

  3. pickledegg
    Member
    Posted 7 years ago #

    I have the same error, but I'm not using the plugin you mention. Any ideas? Thanks!

  4. mcbarron
    Member
    Posted 7 years ago #

    I found the solution - you can download my modified plugin here:
    http://mike.shannonandmike.net/2007/12/18/post-levels-111-fix/

    If you are curious, the problem was due to a regular expression that was not expecting the SQL “FROM” clause to use an alias for the “wp_posts” table. My solution, which is a bit hacky, was to insert expressions to create and then properly handle this alias. I wish a better solution exists, but to my knowledge WordPress doesn’t expose these SQL statements through hooks.

Topic Closed

This topic has been closed to new replies.

About this Topic