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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:06:20+00:00 2026-06-03T09:06:20+00:00

My case is, when someone is posting to my news web data with 600k

  • 0

My case is, when someone is posting to my news web data with 600k records,
they can create the same title which someone just posted in the last few hours with same subject.

data: sid|title|desc|timestamp|userid

Usually I use:

select sid from ".$prefix."_stories WHERE title = '".$subject."' limit 0,1

It searches all data for $subject then notice poster if have they have the same title.
I need a query which searches in the last 100 records.

I tried the following, but this did not work:

select sid from ".$prefix."_stories WHERE title = '".$subject."' and sid > MAX(sid)-100 limit 0,1
  • 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-03T09:06:22+00:00Added an answer on June 3, 2026 at 9:06 am

    Assuming that you have a primary key, incrementing by 1 with every record (which will put newest at the bottom), just do this:

    SELECT sid, title
    FROM ".$prefix."_stories
    ORDER BY sid DESC 
    LIMIT 100
    

    This will select the last 100 records

    Good point by Michael in my comments… Edit to code and further comment:

    Removing the where clause, this will select the last 100 records… Run a loop to check to see if the title or summary already exists:

    while ($row = $result) {
       if $subject = $row['title'] {
          $duplicate = TRUE;
          endwhile;
       }
    }
    

    Just compare the resulting data. Thanks Michael

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

Sidebar

Related Questions

Ran into this problem today, posting in case someone else has the same issue.
This is an open and shut case which will hopefully save someone a headache
In case someone else has same problem and got it solved, would appreciate share
Revisiting this in case someone has a suggestion: I've been asked to either create
EDIT: This code now works correctly, I only left it in case someone finds
I know it is a strange question did someone have had a case where
We work in a mixed case sensitive/insensitive environment (cywgin/linux), and today someone created a
I have written an application that uses the Tinymce editor. The administrator can create
Does someone have any tips/advice on database design for a web application? The kind
My goal: In case someone selects a specific value from an select box something

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.