tbl_addfield.php3: ignore empty fields on alter table

This commit is contained in:
Olivier Müller
2003-02-02 16:50:39 +00:00
parent 4e72fdbd35
commit 24e4a2567f
2 changed files with 15 additions and 3 deletions

View File

@@ -5,6 +5,9 @@ phpMyAdmin - Changelog
$Id$
$Source$
2003-02-02 Olivier L. M<>ller <om@omnis.ch>
* tbl_addfield.php3: ignore empty fields on alter table
2003-02-02 Alexander M. Turek <rabus@users.sourceforge.net>
* libiraries/common.lib.php3, libraries/config_import.lib.php3: Backwards
compatibility.

View File

@@ -40,6 +40,9 @@ if (isset($submit)) {
} // end for
// Builds the field creation statement and alters the table
for ($i = 0; $i < $field_cnt; ++$i) {
if (empty($field_name[$i])) {
continue;
}
if (get_magic_quotes_gpc()) {
$field_name[$i] = stripslashes($field_name[$i]);
}
@@ -124,7 +127,9 @@ if (isset($submit)) {
$primary_cnt = count($field_primary);
for ($i = 0; $i < $primary_cnt; $i++) {
$j = $field_primary[$i];
$primary .= PMA_backquote($field_name[$j]) . ', ';
if (!empty($field_name[$j])) {
$primary .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
$primary = ereg_replace(', $', '', $primary);
if (!empty($primary)) {
@@ -140,7 +145,9 @@ if (isset($submit)) {
$index_cnt = count($field_index);
for ($i = 0; $i < $index_cnt; $i++) {
$j = $field_index[$i];
$index .= PMA_backquote($field_name[$j]) . ', ';
if (!empty($field_name[$j])) {
$index .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
$index = ereg_replace(', $', '', $index);
if (!empty($index)) {
@@ -156,7 +163,9 @@ if (isset($submit)) {
$unique_cnt = count($field_unique);
for ($i = 0; $i < $unique_cnt; $i++) {
$j = $field_unique[$i];
$unique .= PMA_backquote($field_name[$j]) . ', ';
if (!empty($field_name[$j])) {
$unique .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
$unique = ereg_replace(', $', '', $unique);
if (!empty($unique)) {