diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2012-01-22 10:25:28 +0400 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2012-01-22 10:25:28 +0400 |
commit | 3c7b233d9c83b501f5e220a6dcba8259b7554a87 (patch) | |
tree | 39a536cd0d3baa0ee41774455614148cfaa6cfed /tbl_replace.php | |
parent | 5da1aaa0fe7493afecde8ac92a0b561337bf217e (diff) |
bug #3477063 [edit] Missing set fields and values in generated INSERT query
Diffstat (limited to 'tbl_replace.php')
-rw-r--r-- | tbl_replace.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tbl_replace.php b/tbl_replace.php index 98d1b28fd4..cb26a8760b 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -218,7 +218,7 @@ foreach ($loop_array as $rownumber => $where_clause) { if ($is_insert && $using_key && isset($me_fields_type) && is_array($me_fields_type) && isset($where_clause)) { $prot_row = PMA_DBI_fetch_single_row('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';'); } - + // When a select field is nullified, it's not present in $_REQUEST // so initialize it; this way, the foreach($me_fields) will process it foreach ($me_fields_name as $key => $val) { @@ -227,7 +227,10 @@ foreach ($loop_array as $rownumber => $where_clause) { } } - foreach ($me_fields as $key => $val) { + // Iterate in the order of $me_fields_name, not $me_fields, to avoid problems + // when inserting multiple entries + foreach ($me_fields_name as $key => $field_name) { + $val = $me_fields[$key]; // Note: $key is an md5 of the fieldname. The actual fieldname is available in $me_fields_name[$key] |