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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:48:55+00:00 2026-06-07T13:48:55+00:00

I am working on a twitter clone in PHP for school, and I have

  • 0

I am working on a twitter clone in PHP for school, and I have one major problem. I cannot find a way to implement a follower system. There is a table for users, and I want to add a field that holds the ids of all of the users that each user follows.

Should I separate the ids with commas and then split them apart in PHP? And then I need to select all of the tweets from the tweets table that were tweeted by any of the users followers. Is there an SQL command that I can use? Something similar to

SELECT *
FROM tweets 
WHERE author='$followeduser'"

but where $followeduser is multiple ids.

  • 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-07T13:48:56+00:00Added an answer on June 7, 2026 at 1:48 pm

    Have a USER_MASTER table like this

    USER_ID (int)
    USER_NAME(varchar(50))
    

    Create a table called USER_FOLLOWERS like this

    USER_FOLLOWER_ID // Auto increment-Primary Key for this record
    USER_ID (int)  // foriegn key to UserId column in USER_MASTER table
    FOLLOWER_ID (int)  // foriegn key to UserId column in USER_MASTER table
    

    Store the UserId in the first column and store the UserId of the User who follows this user in the Follower_ID column.

    So your data will look like this

    USER_ID    USER_NAME
    --------------------------------------
    1           SCOTT
    2           JARED
    3           MARC
    4           ERIC
    
    USER_FOLLOWER_ID    USER_ID   FOLLOWER_ID
    --------------------------------------
    1                    1          2
    2                    1          3
    3                    1          4
    4                    2          1
    

    So this means , The User Scott has 3 followers, Jared, Marc and Eric. User JARED HAS one Follower, that is SCOTT

    To get the list of Followers for a user(ex : Scott (ID=1)) , you can do a Join between these 2 tables

      SELECT U. USER_ID, U.USER_NAME From USER_MASTER U
      INNER JOIN USER_FOLLOWERS UF ON U.USER_ID=UF.FOLLOWER_ID
      WHERE UF.USER_ID=1  // 1 is the ID of SCott
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi i am working with Twitter, i got problem with images, i have tweet
For those that have been helping me along the way with this twitter-clone, thank
I am working on making a twitter client app. One of the requirement of
I seem to have the Twitter Bootstrap carousel working properly as far as moving
I am working with twitter's oauth, and ive run into a weird problem. How
Is there any known method to have a date input working while using Twitter
I have a working twitter bootstrap install and simple form generates the following: <form
I am working with Twitter's new activerecord-reputation-system gem, yet it doesn't seem to be
I'm making a Twitter clone as a class project. I have a Profile model
i am working on Twitter on iPhone now i have to keep the count

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.