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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:01:41+00:00 2026-05-22T21:01:41+00:00

I’m working on an application that routinely gathers information from a large number of

  • 0

I’m working on an application that routinely gathers information from a large number of websites and saves it to a mysql database with a table for each site. The idea is to create a sort of customizable news feed.

  • stackoverflow_table(id, url, title, date)
  • reddit_table(id, title, url, author, date)
  • github_commit_table(id,
    commit_message, author, repository,
    branch, date)
  • twitter_table(id, tweet, author, url, date)
  • etc…

I want the ability to request any number of news items and filter out certain sites too. As an example:

Show newest 100 items but exclude items from Twitter and GitHub.

It seems like the best way to handle this is to create a table that just has foreign keys and website names.

master_table(id, website, date, foreign_key)

and I can just query the foreign ids I need from this table.

Am I going about this horribly wrong?

  • 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-22T21:01:42+00:00Added an answer on May 22, 2026 at 9:01 pm

    I’ve actually been working on a similar site. Not for other sites, but a kind of Facebook-like site for a niche community with newsfeeds from various sources. I’ve been pondering this question very heavily the past couple of weeks.

    One issue, probably not gamebreaking, but still an issue for me, is that since your foreign_key column isn’t literally a foreign key due to referencing multiple tables, so it can’t get the benefits from things such as referential integrity enforcement.

    What I’m considering is making a GUID table that serves as the source of ids for all of the other tables, and having a table specifically dedicated to the news feed. It might be defined as something like:

    CREATE TABLE sources (
      id INTEGER AUTO_INCREMENT PRIMARY KEY,
      name VARCHAR(20),
      url VARCHAR(50) );
    
    INSERT INTO sources (name, url) VALUES ('Stack Overflow', 'http://stackoverflow.com');
    INSERT INTO sources (name, url) VALUES ('Reddit', 'http://www.reddit.com');
    INSERT INTO sources (name, url) VALUES ('Github', 'http://github.com');
    INSERT INTO sources (name, url) VALUES ('Twitter', 'http://twitter.com');
    /* And so on... */
    
    CREATE TABLE newsfeed (
      guid INTEGER PRIMARY KEY,  -- Note: NOT auto_increment!
      source_id INTEGER NOT NULL,
      timestamp DATETIME NOT NULL,
      text VARCHAR(256),
      ref_id INTEGER NOT NULL,
      FOREIGN KEY (source_id) references sources (id) );
    

    You could still store information about site postings in their own tables, but now you’re just referencing the one newsfeed table for what to actually display on the page, with the ref_id being a pointer to individual source tables if someone wants to deep-dive into the information. It’s still not ideal because ref_id still isn’t a true foreign key, but it’s arguably a little better.

    You might even want to do something like this instead of ref_id:

    data TEXT,
    

    with the contents of that column for any given entry a source-specific data payload. For example, for Github posts, it could contain a JSON string such as:

    {"commit_message":"Updated global variable namespace.",
      "author":"King Skippus","repository":"Ibuware"}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from

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.