From f32311b9f05ab1e60225fccc5c9e30d4a079ad37 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Tue, 7 Aug 2001 00:11:09 +0000 Subject: [PATCH] set with no field selected --- ChangeLog | 2 ++ tbl_replace.php3 | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 931b6fc56..643f25fbe 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ $Source$ when displaying a TEXT field * sql.php3, bug 448226 (Missing MySQL messages), correction from Loic. * tbl_change.php3, bug 442778, Edit record with two similar SET fields + * tbl_replace.php3, could not save a row with a set which has no + value selected 2001-08-06 Steve Alberty * index.php3: remove warning under Apache 2.0.23-dev diff --git a/tbl_replace.php3 b/tbl_replace.php3 index 405272207..8dea46c3a 100755 --- a/tbl_replace.php3 +++ b/tbl_replace.php3 @@ -8,7 +8,6 @@ require('./grab_globals.inc.php3'); require('./lib.inc.php3'); - /** * Initializes some variables */ @@ -90,14 +89,16 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { break; } // end switch - if (empty($funcs[$key])) { - $valuelist .= backquote($key) . ' = ' . $val . ', '; - } else { - $valuelist .= backquote($key) . " = $funcs[$key]($val), "; + if (!empty($val)) { + if (empty($funcs[$key])) { + $valuelist .= backquote($key) . ' = ' . $val . ', '; + } else { + $valuelist .= backquote($key) . " = $funcs[$key]($val), "; + } } } // end while - // Builds the sql upate query + // Builds the sql update query $valuelist = ereg_replace(', $', '', $valuelist); $query = 'UPDATE ' . backquote($table) . " SET $valuelist WHERE $primary_key"; } // end row update