Jump to content

Get data but not from same ID's


eevan79

Recommended Posts

I want to get latest posts from phpbb3 forum. Here is my code:

   $table_posts = "phpbb_posts";
    $table_users = "phpbb_users";

    $sql = "SELECT 
    $table_posts.post_id, 
    $table_posts.topic_id, 
    $table_posts.forum_id,
    $table_posts.post_subject, 
    $table_posts.poster_id, 
    $table_posts.post_time,
    $table_users.user_id,
    $table_users.username
    FROM $table_posts
    LEFT JOIN $table_users ON $table_users.user_id=$table_posts.poster_id 
    WHERE forum_id <> 3 AND forum_id <> 21
    ORDER BY post_time DESC LIMIT 5";

And it's working fine. But I want to improve this code and dont get data from same topic_id .

Thats mean if there is already post from topic_id 45, I dont want to get another post from same topic_id.

 

How to get latest posts, but not from same topic_id?

Link to comment
https://forums.phpfreaks.com/topic/215920-get-data-but-not-from-same-ids/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.