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 7926837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:58:31+00:00 2026-06-03T18:58:31+00:00

Say I have a database table with three fields: id, content and timestamp. Entries

  • 0

Say I have a database table with three fields: id, content and timestamp.

Entries have been coming in all day, so there’s loads of entries and entries will still be coming in periodically.

When a visitor views my webpage that will display the entries, the page will display the 10 most recent PLUS any new entries that come in while the visitor is on the page.

I made a similar post about this issue, and the only answer I got was “USE LIMIT”, but I didn’t get a response if that would prohibit any new entries from coming in while the visitor is on the page.

Here’s what I’m getting at… I want to make the query to my database, then check each entry’s timestamp against a constant NOW() variable. I want to limit the amount the query goes back in time, but leave future posts open to infinity.

  • 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-03T18:58:40+00:00Added an answer on June 3, 2026 at 6:58 pm

    Bear with me if I am not completely answering you question. If I understand this correctly, the issue seems to be solved by doing two queries.

    -- for the 10 most recent on page load
    SELECT timestamp, content FROM table WHERE timestamp < NOW() LIMIT 10; 
    

    Then store the latest item’s timestamp in a variable that I assume you can use in an AJAX call for stuff coming in “live” and use that timestamp to query future items.

    SELECT timestamp, comment FROM table where timestamp > $last_timestamp LIMIT 10;
    

    However, I would still limit the query number and continue to store w/e the last timestamp is in order to not hit an issue where a user sits on a page and the query results grow larger and larger as new posts are entered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have a database table which consists of three columns: id ,
Let's say I have two tables with several fields and in every table there
Say I have a database table T with 4 fields, A, B, C, and
Say I have a database table like the following: FileID | FileName | FileSize
Let's say I have the following database table: record_id | record_date | record_value -----------+-------------+--------------
Say I have a database called Poll and have these two table structures. poll
Let's say you have a database with a single table like... --------------------------------------------- | Name
Question says all really... I have table in a MySQL database which has a
Say I have a database of clothing products. In addition to many other fields,
Let's say that I have a 'Scores' table with fields 'User' , 'ScoreA' ,

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.