追加/削除ボタンをクリックして新しい行を動的に追加/削除できるテーブルを含むフォームがあります。
私の問題は、新しく追加/削除された行をデータベースに保存しようとしたときに始まります。jQuery の Ajax を使用してデータを保存できたので、post var を使用せず、各入力のすべてのデータを「収集」しています。これらすべてのデータを取得し、それらを保存している store.php に送信することができました。
私の質問は、本当に少ないクエリで変更を保存するにはどうすればよいかということです。つまり、これは store.php が私の mysql サーバーに送信している出力です。
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
すべてのデータを 1 つずつ保存するのに 5 秒ほどかかるため、これは非常に遅いと言う必要はありません。