in reply to How to get a placeholder to keep the current column value?
Then, in your example, you just end up with sql looking like:my $sql='UPDATE table SET '.join',',map {"$_=".quote($hash{$_})} keys +%hash;
Obviously you need a where statement and so on, but thats simple. This way you only touch the fields you want to change and you don't need to worry about restoring the old values and fun stuff like that. The only problem I see is if they wanted to submit say, an empty field and not update the value which would probably require something slightly more complicated then a nice map, but perhaps you could chain maps:UPDATE table SET phone='456'
map {"$_=".quote($hash{$_})} grep defined $hash{$_},keys %hash;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to get a placeholder to keep the current column value?
by castaway (Parson) on Oct 26, 2003 at 20:48 UTC | |
by BUU (Prior) on Oct 26, 2003 at 23:53 UTC |