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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:22:11+00:00 2026-05-26T08:22:11+00:00

If I have a tag system like Stackoverflow. I can add tags, save and

  • 0

If I have a tag system like Stackoverflow. I can add tags, save and after delete a tag, or add new tags.

For example, initially:

PHP, JQUERY, ARRAYS

save question and publish,

I changed my mind, and I will delete JQUERY, so I edited my question to only two tags:

PHP, ARRAYS

My question is: what is the best way to remove the tag from database after inserted?
I need to check which tag is removed.

Any idea? Thanks!

To clarify the problem:

i have a many- to -many table

$first = array (php, jquery, arrays)

question1 | php
question1 | jquery
question1 | arrays

after edited, i will have (the goal):

$first = array (php, jquery)

question1 | php
question1 | jquery

to add new tags is easy. Unique constrain, and a foreach solves the problem.
But to remove tags. I need to remove the specific tag arrays from the junction table.

the question is how ?

so, i have this array: $first = array (php, jquery)

and this table structure (THIS IS THE PROBLEM):

question1 | php
question1 | jquery
question1 | arrays
  • 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-26T08:22:12+00:00Added an answer on May 26, 2026 at 8:22 am

    This is best implemented as a many-to-many relationship.

    You do this by using a junction table. For example

    QUESTION
    ========
    id, -- primary key
    whatever
    
    TAG
    ===
    id, -- primary key
    tag -- probably best with UNIQUE constraint
    
    QUESTION_TAG
    ============
    question_id, -- composite primary key, foreign key references QUESTION (id)
    tag_id -- composite primary key, foreign key references TAG (id)
    

    To remove a tag for a question, simply delete the record from the QUESTION_TAG table, eg

    DELETE FROM `QUESTION_TAG`
    WHERE `question_id` = :question_id
    AND `tag_id` = :tag_id
    

    Update

    Your best bet is to make tag removal a capture-able event. What I mean by this is that each removal is handled in a way so you are able to capture the tag to be removed.

    Another approach is to remove all QUESTION_TAG entries for the question and re-insert the tags to keep.

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

Sidebar

Related Questions

I have a StackOverflow-like tagging system for a database I'm working on. And I'm
I have code like this string pattern = <(.|\n)+?>; System.Text.RegularExpressions.Regex regEx = new System.Text.RegularExpressions.Reg(pattern);
I have a Div Tag which contains 4 child Div Tags <Div id=Parent> <div
I have a basic tag searching system setup, each tag has a field for
I would like to have pretty URLs for my tagging system along with all
I've got this tag system for tagging blog entries and such. The tags are
So I'm working on a tags system, and I have a field that looks
I'm going to be creating a system with Node.js where I can tag images
i try to save an margin value in a resourcedictionary. Something like that: xmlns:systemwindows=clr-namespace:System.Windows;assembly=System.Windows.dll
I'm working on a little blog software, and I'd like to have tags attached

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.