From: Steinar H. Gunderson Date: Wed, 16 Feb 2005 14:35:20 +0000 (+0000) Subject: Make it possible to enter NULL values by leaving fields blank. X-Git-Url: https://git.sesse.net/?p=ccbs;a=commitdiff_plain;h=ed77839b314639904743a85ff4ea4c5079102464 Make it possible to enter NULL values by leaving fields blank. --- diff --git a/html/do-edit-scores.pl b/html/do-edit-scores.pl index fe29c16..8b28303 100755 --- a/html/do-edit-scores.pl +++ b/html/do-edit-scores.pl @@ -20,9 +20,12 @@ for my $p ($cgi->param()) { next unless (defined($cgi->param('old-' . $p))); next if ($cgi->param($p) eq $cgi->param('old-' . $p)); + my $val = $cgi->param($p); + undef $val if ($val =~ /^\s*$/); + if ($p =~ /^score(\d+)-(\d+)/) { $dbh->do('UPDATE scores SET score=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=?', undef, - $cgi->param($p), $tournament, $round, $group, $1, $2); + $val, $tournament, $round, $group, $1, $2); } }