Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8418345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:17:58+00:00 2026-06-10T02:17:58+00:00

Ive got two tables, One for topics and one for replys. +——————+ +——————+ |

  • 0

Ive got two tables, One for topics and one for replys.

+------------------+     +------------------+
| forum_topics     |     | forum_posts      |
+------------------+     +------------------+
| topic_id         |     | post_id          |
| topic_title      |     | post_content     |
| topic_contents   |     | post_date        |
| topic_date       |     | topic_id         |
| topic_keywords   |     |                  |
+------------------+     +------------------+

I want it so when a user views the page with the topic on and reads the topic it gets marked as read for that specific user. But if another user comes and replies to that thread, I want it to marked as new post since last visit or somthing similar.

Any ideas?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:18:00+00:00Added an answer on June 10, 2026 at 2:18 am

    You can do this with a lookup table connected to the user and forum posts like this:

    When the user views a forum, enter a row into the lookup table like

    userID, topic_id, post_id, currentTime
    

    Then to determine whether the user has already read this forum, you can query the table to see whether their userID appears in it – this means they have read it.

    You can then compare the currentTime column to the last entry in the forum/thread to see which is greater which will tell you whether the user has seen the last post or not.

    Edit: Yes, you will need to add a datetime column to the topics and posts (it is normally good practice anyhow to know when a post was made) and as for some PHP/SQL:

    <?php
    $userUpdateTime = gmdate(); // assumed to be either dateTime or unixTimestamp of when user last red the topic/forum
    $qry = '
    SELECT
        IF(`forum_topics`.`updateDateTime` > "'.$userUpdateTime.'", "unRead", "Read")
    FROM
        `forum_topics` ';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got two tables, Products and ProductImages with a one to many relationship between
Say I've got two tables. One contains a list of items, and one contains
I've got two tables - one is Product and one is ProductSearchResult. Whenever someone
I've got two tables in SQL, one with a project and one with categories
I've got two tables. One of them contains quotes and the other one lists
I've got a bunch of strongly typed DataSet that each have two tables. One
I've got two tables. Table B has a one to many relationship with Table
Ive got two tables company and process. Company has field company_id and others. Process
What i've got is these two tables: One prefix can be used by unlimited
I've got two tables (articles and tags) that have a one-to-many relationship. I remember

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.