Forums

custom comments query (3 posts)

  1. shansta
    Member
    Posted 4 months ago #

    I hoping someone can help me. I am trying to create a authors profile page which also displays a users recent comments. Problem is the query keeps showing the same comments in every post when I do a query on the database.

    SELECT comment_ID, comment_post_ID, comment_content, post_title FROMwp_posts,wp_comments WHERE comment_author_email = 'email@email.com'

    So the result is its showing the comments but with the wrong post title.

    Here is my author.php
    http://pastebin.com/pMPnvpFR

  2. vtxyzzy
    Member
    Posted 4 months ago #

    I have not tested it, but I believe that you need to add this to your WHERE clause:

    AND comment_post_ID = ID

  3. shansta
    Member
    Posted 4 months ago #

    Thanks. I worked it out and yeh that solved the problem.

Reply

You must log in to post.

About this Topic