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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:56:49+00:00 2026-05-26T07:56:49+00:00

I need to add article to multiple category for example I have article name

  • 0

I need to add article to multiple category
for example I have article name ‘test article’ need to add it to category 1 and category2
need to know how to make relationship between to tables for this

note : in the past I make row in article database table name ‘category’ and add category id like 1,2,3 but this make problem in search and list please help me about that

  • 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-26T07:56:50+00:00Added an answer on May 26, 2026 at 7:56 am

    You need three tables:

    • One table for articles
    • One table for categories
    • One table linking articles to categories, we might call it categories_per_article. This table often is called a Junction table or a Association table.

    Example data:

    ARTICLES
    ID | Name | Description
    1  | Fuzz | A fuzzy three
    2  | Bizz | A five that means bizznezz
    
    CATEGORIES
    ID  |  Name 
    1   |  Prime numbers
    2   |  Multiples of five
    3   |  Smaller than four
    
    CATEGORIES_PER_ARTICLE
    ID | ARTICLE_ID | CATEGORY_ID
    1  | 1          | 1
    2  | 1          | 2
    3  | 1          | 3
    4  | 2          | 1
    

    You will see that article 1 (Fuzz) has three categories, and article 2 (Bizz) only has category 1. We call this a many-to-many relationship (or n-to-n, for example in ER or UML), because article 1 has multiple categories, and category 1 is used by multiple articles.

    You can do all possible queries using this schema – feel free to ask in comments for specific examples (like How do I get all articles which have categories 1 and 3 but not 2).

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

Sidebar

Related Questions

I need to add a specific column if it does not exist. I have
I need to add a tooltip/alt to a td element inside of my tables
I need to add multiple empty divs to a container element using jQuery. At
I have the following relationship User --> has_many: Articles Article --> belongs_to: User I
I have a Publishing Portal site and I need to add some announcements to
I have a UserControl that I need to add dynamically. I tried to follow
I have a component for Joomla which I need to add an admin editable
In database I have 2 tables: Article: ID | Title| SectionID Section: ID |
I have a website where users may upload images... I need to add my
I need to add barcode reading feature to my application. I donot know how

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.