Best Practice Updating Database Entries

Say you get 100 entries and display them on a page. User updates only 2 records per page. Now you want to update only two records, not the other 98.

Is it best that a single message is sent on the page, then somehow find out which 2 updates, and then send only these two in db for the update?

What does it look like?

Or do you have an update-submit button for each row, and only it will update the record bound to it?

+3
source share
5 answers

, . , , Javascript POST , . , :

1) ajax live -editing. , , . , , Javascript html- . - (, ), POST, ( ajax). , Javascript .

2) - , , . , javascript POST, , . , .

+1

Ajax jQuery - JavaScript put update .

0

, - "" .

Ajax- , , Ajax .

, , , ADO.net .

, , : " !"

0

JavaScript, , . , , . ( is_dirty_ $id) JavaScript onChange, . - .

. . , , .

, last_modified . , , , , " ​​ " .

0

. , , . ( , - , .)

, :

JavaScript: onChange() , . , . JS , , .

: , . , , ( ). , - .

Sessions. You can put the original values ​​in session variables, and then perform a comparison when the values ​​return. This would be a little more elegant than a lot of hidden fields, and less open to people playing with data published back (since you should never trust anything that comes back, even in hidden fields). Requires browser cookies and server technology sessions.

-1
source

Source: https://habr.com/ru/post/1704363/


All Articles