Subject Re: [firebird-php] Grid data entry
Author Rajesh Kumar
Almond wrote:

> My first idea is save the original data in array. Upon post back of data,
> compare the content. It is simple and stupid. But it is better than re-read
> the db and compare the record content row by row.
>
> Any good idea ?

This sounds like a god idea, except for the fact of storing the old
values as hidden fields (or session variables). Once the form has been
submitted, you are going to be comparing old data. Numerous updates
might have taken place from the time the form was loaded, to being
submitted. What if someone loaded the page tonight, and submitted it
next day morning?

Ofcourse this does not apply to cases where only you would be doing the
updates.

My theory is to get a fresh copy from the db (just one more query), and
then compare the data, and then perform the update query for the
modified data. Ofcourse, all this is very quick, as everything is looped.

To prevent updates when data is being checked, table locking is recommend.

Whatever, this method is still better than updating each and every row,
but the hidden field theory doesn't seem to be practical.

--
[ Rajesh Kumar ]
__________________________________________
Meet the guy at http://www.meetRajesh.com/