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

  • Home
  • SEARCH
  • 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 4014882
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:33:03+00:00 2026-05-20T09:33:03+00:00

hello im just curious. about how they do stuff. what i assume they do

  • 0

hello im just curious. about how they do stuff. what i assume they do something like this

@someone1 im stacking on stackoverflow RT @someone2 : hello guys what are you doing?

before i do it in my way i want to tell you about my database scheme

// CID = COMMENT ID, BID  = BLOG ID, UID = USER ID
CID    BID   UID    COMMENT
1       1     1      @someone1 im stacking on stackoverflow RT @someone2 : ....
2       1     4      @someone1 im stacking on stackoverflow RT @someone2 : ....
3       1     12     @someone1 im stacking on stackoverflow RT @someone2 : ....
  1. they use regex to do like this to take the @someones name

    preg_match_all("/@[a-zA-Z0-9_]+/", $text, $matches);
    
  2. then they get the @ off each name

    foreach ($matches as $value) {
    foreach ($value as $value) {
        $usernames[] = substr($value, 1);
    }
    }
    
  3. then they get the UID from the database from doing something like this

    foreach ($username as $value) {
    # insert database one by one ? so it will be like the example above
    }
    

then we can just output the comment buy geting the UID.

then somhow we can get all the comments in the blog. ( without a same comment ) where blog buid = 1 and give them an notification on every user by where uid = :uid.

is there any better way doing this ? something like twitter or convore ?

Thanks for looking in

Adam Ramadhan

  • 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-05-20T09:33:04+00:00Added an answer on May 20, 2026 at 9:33 am

    I have done something similar to this with an in-house application that we use for communication.

    Basically, you are going to have two tables: status_updates and mentions. Each status update has many mentions. Whenever someone creates a status update, you save it to the status_updates table. During this process, you can also use Regex to detect any @username “mentions”. When you find a mention, you add it to your mentions table. For example, your mentions table might look something like this:

     mention_id (Auto-incrementing key) | status_message_id | username_id
    

    That way if you want to see if someone is mentioned in a status message you can do a quick lookup in the status_messages table, as opposed to loading up the status message and running the Regex each time. The other nice thing about this approach is that it allows you to have multiple mentions in each status message. Just create a record in mentions for each.

    That’s the basic way that we have set it up.

    EDIT: If you wanted to pull an “activity feed” for a given user, showing only the status updates in which they have been mentioned, it would be as simple as:

    SELECT * FROM mentions m LEFT JOIN status_messages s ON m.status_message_id = s.id WHERE m.username_id = $username_id
    

    I should note that this is not how they do it at Twitter, because they are dealing with issues of scale that would make this simple way of doing things impossible. However, I think this is the simplest solution that works well if you aren’t worried about scaling to hundreds of thousands of users. If you are, then you probably have more issues on your hands than this.

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

Sidebar

Related Questions

No related questions found

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.