|
Posted by J.O. Aho on 03/09/07 08:25
Kenoli wrote:
> The way I have it set up is that when they are through, they perform a
> submit and all records are updated. There are some problems with
> this, including the fact that if someone gets to this page in a way
> that no data is displayed and hits update, they could erase the whole
> database.
1. See to that you can't get to the page in a such way.
2. Check the data before committing anything, things that erase you could
ignore and then ask the user if they are sure about that on another page,
where the user can select yes or no, if selecting yes, first then delete.
> Is there any way to update only the records that have been changed?
You could make an update where you compare the md5 sums, for the whole row in
the database against the md5 fro the data you would be updating.
Using javascript, you could have a hidden filed which you set if a value has
been updated for a row, then on submit you could select to remove those fields
not changed from be sent, or use the hidden field in the php to not use those
unset in your update statement. Javascript always requires that the client has
it enabled, today you can't count on it as javascript can be used to bad
thing, so there are quite many who disables it.
--
//Aho
[Back to original message]
|