Results 1 to 2 of 2
Dec 23, 2012, 21:33 #1
- Join Date
- Oct 2003
- Prescott Valley, Arizona, United States
- 0 Post(s)
- 0 Thread(s)
Run an update from form, all fields or just changed?
Not sure if this would be more appropriate in the database section, but I feel this is more a PHP question.
When you have a form that gets populated with results from a database, then the user has the ability to make changes to the forms information (such as for an Employee record where they update an address). Is it preferred to issue a full UPDATE command with ALL the fields, or iterate through each field, test if it has been modified (whether it is a text field, checkbox, etc) and then compile the SQL Update query to ONLY update the changed fields?
On the one hand I feel that it would be quite a bit more overhead to check every field to see if it matches the original values, but then it also seems a bit of overkill to rewrite every field in a database record when possibly only a single item needs to be changed.
What is the preferred/recommended practice in a case such as this?