Updating fields mysql
2) running a second SELECT statement and comparing the $_POST vars tothe returned values, and only UPDATING those that have changed.3) including a hidden form field for each field with the originalvalues (so for each ), comparing $_POST['field1'] with$_POST['field2'] and only updating those that have changed. There's very little chance that two users will be updating the sametable at the same time with this particular site, but anyone see anyparticular problems with any of the above three methods?Woulddoubling the number of $_POST vars (option 3) create a problem?This is the technique I usually use for doing form based database updates.An add/insert is similar but there's no data to pre-fill the form with. Let's say I have an html form with 20 or 30 fields in it.
In the case of such a journal (which we run here pretty much on all tables), it would change the journal timestamp, even if nothing has been updated.
Does this make sense, or am I pulling things apart too much? This is the simplest solution, and I can't see any problems with it. Sometimes users will be submitting a form that has fields for one record in one table, but sometimes they will be using a form with 30 or 40 rows of fields for 30 or 40 records.