diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 21557db76e..bb8b9eaf3c 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -2372,4 +2372,18 @@ function PMA_verifyWhetherValueCanBeTruncatedAndAppendExtraData( } +/** + * Function to get the fields of a table + * + * @param string $db current db + * @param string $table current table + * + * @return array + */ +function PMA_getTableFields($db, $table) +{ + $GLOBALS['dbi']->selectDb($db); + return array_values($GLOBALS['dbi']->getColumns($db, $table)); + +} ?> diff --git a/tbl_change.php b/tbl_change.php index 54481a9899..bcd3f79e3e 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -119,12 +119,8 @@ if (! empty($disp_message)) { $response->addHTML(PMA_Util::getMessage($disp_message, null)); } -/** - * Get the list of the fields of the current table - */ -$GLOBALS['dbi']->selectDb($db); -$table_fields = array_values($GLOBALS['dbi']->getColumns($db, $table)); +$table_fields = PMA_getTableFields($db, $table); /** * Determine what to do, edit or insert?