I have a ASP file with using perlscript. It has one form with 8 fields. After the user fills them in, they are inserted into a database. Afterwards they can either do nothing, update, or delete the entry. What I want to know is what is the best or most efficient way to check which fields where changed so that I can update the database.
I have all of the original entries in an array "@input" and the new entries (whether changed or not) in another array "@inputUpdate".
Now how can I compare these two in order to have the most 'accurate' sql query?
I was thinking of going through each field and comparing the one at a time like:
Or something like that (for some reason it didn't let me put the equals sign in the code instead of "eq"). But the problem is that I don't know which fields or how many of them will be changed.if ($input[0] ne $inputUpdate[0]) { my $dbquery eq "UPDATE table_name SET column_name=$inputUpdate[0] WHER +E column_name=$input[1]"; }
In reply to Best way to check which field(s) was changed by josh097
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |