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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:07:13+00:00 2026-05-19T13:07:13+00:00

I have a Many-to-Many table, in which I input some form info. I recently

  • 0

I have a Many-to-Many table, in which I input some form info. I recently made this form dynamic, so that when an input elements value is changed, it is sent to database via AJAX.

So my question is:
Is it faster to try and find the values that exist, edit them, create the ones that don’t and delete the ones that are not used anymore OR Should I delete all of the values for the id, and insert all of the new ones?

In response to comment, an elaboration.

  • A form , that has about 10 fields. Some of them mandatory, some not. Every time you access it, it generates a random identifier.
  • When a user starts filling the form, after the focus an element is lost, the whole form is submitted through AJAX, and all of the values that are not empty, are input in the many to many table.
  • The table has 3 fields : form identificator , element name , element value;

The question rephrased:
Do I delete all of the entries with the required form identificator, or try to find the fields and edit them?

  • 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-19T13:07:14+00:00Added an answer on May 19, 2026 at 1:07 pm

    It will require less code to delete all the existing relations and add new ones

    • Make sure you do this in a transaction
    • Handle errors correctly

    Less code == fewer bugs, less developer time. So that is definitely faster.

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

Sidebar

Related Questions

I have a table which contains many records. I'm looking for an efficient way
I have a table which has several one to many relationships with other tables.
I have a warehouse_products table which defines how many products in the warehouses so
i have a many to many table relationship that involves 2 logical tables. Record
In each table have many number of rows with amount. Like this i have
I have a favorite table containing some fields like login_id,driver_id(One login_id may have many
I have a table in a form with a loop around it that sets
I have a table called order which has many order_items , each order_items is
I have a table, say STUDENTS, that is related one-to-many to another table, CLASSES.
I have a table containing user input which needs to be optimized. I have

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.