• Hi, I installed Nick’s recent comments plugin and I get this big fat error:

    Database error: [You have an error in your SQL syntax near ‘LEFT JOIN ON .ID=.comment_post_ID AND post_status = ‘publish’ AND comment_appro’ at line 1]
    SELECT ID, comment_ID, comment_content, comment_author, post_title FROM LEFT JOIN ON .ID=.comment_post_ID AND post_status = ‘publish’ AND comment_approved = ‘1’ ORDER BY comment_ID DESC LIMIT 5

    Here’s the tag I used to call the recent comments:

    <?php get_recent_comments(5, 7, ”, ‘
    ‘, true, 1); ?>

    Any ideas?

Viewing 12 replies - 1 through 12 (of 12 total)
  • This is exactly the same error that I get, hopefully someone will give us a clue to fix this error.

    I haven’t tried it — and I’m no PHP pro yet — but it looks to me as if there’s something wrong with the syntax. Specifically, there’s a quotation mark (“) that isn’t closed. Or maybe it’s closed, but wasn’t opened.

    Barring getting a better reply, I’d play around with that.

    I don’t have a left join in there at all. You’ve either got a newer version or an older version of what I have…this is what I have now:

    function get_recent_comments($no_comments = 5, $comment_lenth = 5, $before = '<li>', $after = '</li>', $show_pass_post = false) {
    global $wpdb, $tablecomments, $tableposts;
    $request = "SELECT ID, comment_ID, comment_content, comment_author FROM
    $tableposts, $tablecomments WHERE $tableposts.ID=$tablecomments.comment_post_ID
    AND post_status = 'publish' ";
    if(!$show_pass_post) { $request .= "AND post_password ='' "; }
    $request .= "AND comment_approved = '1' ORDER BY $tablecomments.comment_date DESC LIMIT $no_comments";
    $comments = $wpdb->get_results($request);
    $output = '';
    foreach ($comments as $comment) {
    $comment_author = stripslashes($comment->comment_author);
    $comment_content = strip_tags($comment->comment_content);
    $comment_content = stripslashes($comment_content);
    $words=split(" ",$comment_content);
    $comment_excerpt = join(" ",array_slice($words,0,$comment_lenth));
    $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
    $output .= $before . '<strong>' . $comment_author . ':</strong> <br /><a href="' . $permalink;
    $output .= '" title="View the entire comment by ' . $comment_author.'">' . $comment_excerpt . '...</a>' . $after;
    }
    echo $output;
    }

    Thread Starter thepete

    (@thepete)

    Hey, Error–thanks for posting your code! It works for me!! Much obliged!!

    Thanks a lot Error! It works for me too.

    What is the line I should modify to eliminate the extra space in between comments?

    Thread Starter thepete

    (@thepete)

    I think you just want to remove the < li > tags in the plugin itself. That’s just my guess though–as it is I don’t have any extra space in between comments. It also could be in the actual tag you use to refer to the plugin. I use something like this:

    <?php get_recent_comments(5, 5, ”, ‘
    ‘, true, 1); ?>

    That puts no space in between each comment. In your case it could be a situation where your CSS tells your lists to space that way. I’m too much of a novice to know just by looking. Sorry… It looks like you have a cool blog, BTW. I wish I knew Spanish so I could read it.

    Thanks Thepete, I belive I was missing this portion:
    (5, 5, ”, ”, true, 1); ?> after I added this info, the extra spaces were gone, however everything is too close now. What is the function of this line anyway?

    Thanks for the comments about my blog, if you get some time use the google translator, I talk about some pretty good stuff there 😉

    Beautiful!! … I was able to figure it out, this is how I did it:

    • <h2>Comentarios</h2>
      <?php get_recent_comments(5, 7, ‘
      ‘, ‘
      ‘, true, 1); ?></br>
    • I used the

      bye – Thanks for your excellent tip Thepete

    Thread Starter thepete

    (@thepete)

    You’re welcome Joscarfas–wasn’t nothing!! 🙂 As for using the google translator, I’m hoping some enterprising person/site will provide a translator for WP or blogs in general.

    Oh well, I can hope!

    Thread Starter thepete

    (@thepete)

    Oh yeah and I wanted to mention I did traslate your site with Google–very interesting stuff!! I just wish Google did a better job–that’s some pretty heady stuff you guys are writing about there. Cool stuff!!

    Thanks – glad you liked it

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

The topic ‘Recent Comments Big Fat Error’ is closed to new replies.