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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.