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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:33:00+00:00 2026-06-11T17:33:00+00:00

I have a form with a table where new rows can be added/deleted dynamically

  • 0

I have a form with a table where new rows can be added/deleted dynamically by clicking on add/remove button.

My problem begin when I try to save the new added/removed rows back into the database. I managed to use jQuery’s Ajax to save the data, so I’m not using post var and I’m “harvesting” all the data on each input. I managed to take all these data and send them to my store.php which is storing them.

My question is, how can I save my changes with really few query, I mean, this is the output of what the store.php is sending to my mysql server:

UPDATE transport SET transporttype = "3" WHERE id = 1
UPDATE transport SET transporttype = "2" WHERE id = 6
UPDATE transport SET transporttype = "1" WHERE id = 7
UPDATE transport SET transportmandataire = "1" WHERE id = 1
UPDATE transport SET transportmandataire = "3" WHERE id = 6
UPDATE transport SET transportmandataire = "3" WHERE id = 7
UPDATE transport SET transportexpediteur = "1" WHERE id = 1
UPDATE transport SET transportexpediteur = "3" WHERE id = 6
UPDATE transport SET transportexpediteur = "3" WHERE id = 7
UPDATE transport SET transportdestinataire = "1" WHERE id = 1
UPDATE transport SET transportdestinataire = "2" WHERE id = 6
UPDATE transport SET transportdestinataire = "4" WHERE id = 7
UPDATE transport SET transporttransporteur = "5" WHERE id = 1
UPDATE transport SET transporttransporteur = "4" WHERE id = 6
UPDATE transport SET transporttransporteur = "3" WHERE id = 7
UPDATE transport SET transportbondetransportnumerodesuivi = "1563123" WHERE id = 1
UPDATE transport SET transportbondetransportnumerodesuivi = "23544" WHERE id = 6
UPDATE transport SET transportbondetransportnumerodesuivi = "23544" WHERE id = 7
UPDATE transport SET transportlivraisonprevisiondate = "1" WHERE id = 1
UPDATE transport SET transportlivraisonprevisiondate = "1" WHERE id = 6
UPDATE transport SET transportlivraisonprevisiondate = "1" WHERE id = 7
UPDATE transport SET transportlivraisonconstatdate = "test" WHERE id = 1
UPDATE transport SET transportlivraisonconstatdate = "test" WHERE id = 6
UPDATE transport SET transportlivraisonconstatdate = "test" WHERE id = 7
UPDATE transport SET transportlivraisonconstatheure = "test" WHERE id = 1
UPDATE transport SET transportlivraisonconstatheure = "test" WHERE id = 6
UPDATE transport SET transportlivraisonconstatheure = "test" WHERE id = 7
UPDATE transport SET transportlivraisonprevisiondate = "1" WHERE id = 1
UPDATE transport SET transportlivraisonprevisiondate = "1" WHERE id = 6
UPDATE transport SET transportlivraisonprevisiondate = "1" WHERE id = 7
UPDATE transport SET transportlivraisonprevisionheure = "1" WHERE id = 1
UPDATE transport SET transportlivraisonprevisionheure = "1" WHERE id = 6
UPDATE transport SET transportlivraisonprevisionheure = "1" WHERE id = 7
UPDATE transport SET transportetat = "6" WHERE id = 1
UPDATE transport SET transportetat = "1" WHERE id = 6
UPDATE transport SET transportetat = "6" WHERE id = 7
UPDATE transport SET transportimperatif = "09/17/2012" WHERE id = 1
UPDATE transport SET transportimperatif = "09/18/2012" WHERE id = 6
UPDATE transport SET transportimperatif = "09/09/2012" WHERE id = 7
UPDATE transport SET transportbondetransportmoyendetransmission = "2" WHERE id = 1
UPDATE transport SET transportbondetransportmoyendetransmission = "2" WHERE id = 6
UPDATE transport SET transportbondetransportmoyendetransmission = "1" WHERE id = 7
UPDATE transport SET transportbondetransportassurance = "86" WHERE id = 1
UPDATE transport SET transportbondetransportassurance = "86" WHERE id = 6
UPDATE transport SET transportbondetransportassurance = "86" WHERE id = 7
UPDATE transport SET transportobservation = "Aucune observation disponible." WHERE id = 1
UPDATE transport SET transportobservation = "Aucune observation disponible." WHERE id = 6
UPDATE transport SET transportobservation = "Aucune observation disponible." WHERE id = 7
UPDATE transport SET transportreclamationmotif = "3" WHERE id = 1
UPDATE transport SET transportreclamationmotif = "4" WHERE id = 6
UPDATE transport SET transportreclamationmotif = "1" WHERE id = 7
UPDATE transport SET transportreclamationnumerosuivis = "B87GT9" WHERE id = 1
UPDATE transport SET transportreclamationnumerosuivis = "656786" WHERE id = 6
UPDATE transport SET transportreclamationnumerosuivis = "C89GF8" WHERE id = 7
UPDATE transport SET transportreclamationdate = "09/17/2012" WHERE id = 1
UPDATE transport SET transportreclamationdate = "09/10/2012" WHERE id = 6
UPDATE transport SET transportreclamationdate = "09/24/2012" WHERE id = 7
UPDATE transport SET transportreclameetat = "2" WHERE id = 1
UPDATE transport SET transportreclameetat = "1" WHERE id = 6
UPDATE transport SET transportreclameetat = "1" WHERE id = 7
UPDATE transport SET transportreclamationrelancedate = "09/19/2012" WHERE id = 1
UPDATE transport SET transportreclamationrelancedate = "09/04/2012" WHERE id = 6
UPDATE transport SET transportreclamationrelancedate = "09/17/2012" WHERE id = 7
UPDATE transport SET transportreclamationrelancemoyen = "1" WHERE id = 1
UPDATE transport SET transportreclamationrelancemoyen = "1" WHERE id = 6
UPDATE transport SET transportreclamationrelancemoyen = "1" WHERE id = 7
UPDATE transport SET transportindemnisationdate = "09/06/2012" WHERE id = 1
UPDATE transport SET transportindemnisationdate = "09/19/2012" WHERE id = 6
UPDATE transport SET transportindemnisationdate = "09/11/2012" WHERE id = 7
UPDATE transport SET transportindemnisationmontant = "600" WHERE id = 1
UPDATE transport SET transportindemnisationmontant = "600 €" WHERE id = 6
UPDATE transport SET transportindemnisationmontant = "600" WHERE id = 7
UPDATE transport SET transportindemnisationmoyen = "1" WHERE id = 1
UPDATE transport SET transportindemnisationmoyen = "1" WHERE id = 6
UPDATE transport SET transportindemnisationmoyen = "1" WHERE id = 7
UPDATE transport SET transportreclamationobservation = "Non pas d'observation" WHERE id = 1
UPDATE transport SET transportreclamationobservation = "non plus" WHERE id = 6
UPDATE transport SET transportreclamationobservation = "encore moins" WHERE id = 7

No need to tell you this is slow as hell, something like 5 sec to store all data one by one.

  • 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-11T17:33:01+00:00Added an answer on June 11, 2026 at 5:33 pm

    You could make use of ON DUPLICATE KEY UPDATE:

    INSERT INTO table (id,Col1,Col2) VALUES (1,1,1),(2,2,3),(3,9,3),(4,10,12)
    ON DUPLICATE KEY UPDATE Col1=VALUES(Col1),Col2=VALUES(Col2);
    

    Small summary of what it does:

    If you specify ON DUPLICATE KEY UPDATE, and a row is inserted that
    would cause a duplicate value in a UNIQUE index or PRIMARY KEY, an
    UPDATE of the old row is performed.

    If you’re running these queries from a PHP script, you should make sure that you’re using prepared statements (mysqli or PDO). If you’re using the regular mysql extension, you’ll be making a round-trip to the database server with each query. However, with prepared statements, you can group similar queries into one prepared statement and execute it multiple times with different data.

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

Sidebar

Related Questions

I have a form/table that is dynamically altered via JS by adding/removing rows (form
I have a web form which has dynamic table using repeating rows. New rows
I have some Javascript that dynamically adds rows/fields when you click the button, Add
I have a table form which contains a part where the rows can be
I have my form in a table and I use this code to add
I have a form which lets you add names to the table and shows
I have a button that will create a new entry (row in a table)
I have a form which has the possibility to dynamically create new row with
I have a form and I'm using the jQuery Table AddRow plugin to dynamically
I have a form with a table source, the form has a few fields

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.