tags:

views:

45

answers:

1
$sql = mysql_query("SELECT * FROM posts WHERE post_content = 'thread' ORDER BY post_date DESC LIMIT 65");
 while($row = mysql_fetch_array($sql)){
 echo "
  • $row['post_contentID']
  • "; }

    I'm want to list forum threads that there has recently been posts posted in. The "problem" is that it lists the same thread more than once. If I have posted in a thread like 5 times it will show all the 5 times I just want it to show it 1 time...this is hard to explain when your english is not so wide...

    Like they have on this site http://stackoverflow.com/?sort=active You know if i would answer a question that is in the bottom, it will show on the top for me it shows all posts that has been posted in the thread.

    Thanks Piotr

    +1  A: 

    Try changing to:

    SELECT * FROM posts
    WHERE post_content = 'thread'
    GROUP BY post_contentID
    ORDER BY MAX(post_date) DESC
    LIMIT 65
    

    Note that I'm assuming that "post_contentID" is the thread id, if it's not, you need to use the thread id in the GROUP BY clause instead.

    Chad Birch