2 /* vim: set expandtab sw=4 ts=4 sts=4: */
9 * Gets some core libraries
11 require_once './libraries/common.inc.php';
12 require_once './libraries/mysql_charsets.lib.php';
14 PMA_checkParameters(array('new_db'));
17 * Defines the url to return to in case of error in a sql statement
19 $err_url = 'main.php?' . PMA_generate_common_url();
22 * Builds and executes the db creation sql query
24 $sql_query = 'CREATE DATABASE ' . PMA_backquote($new_db);
25 if (!empty($db_collation)) {
26 list($db_charset) = explode('_', $db_collation);
27 if (in_array($db_charset, $mysql_charsets) && in_array($db_collation, $mysql_collations[$db_charset])) {
28 $sql_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
30 unset($db_charset, $db_collation);
34 $result = PMA_DBI_try_query($sql_query);
37 $message = PMA_Message
::rawError(PMA_DBI_getError());
38 // avoid displaying the not-created db name in header or navi panel
40 $GLOBALS['table'] = '';
41 require_once './libraries/header.inc.php';
42 require_once './main.php';
44 $message = PMA_Message
::success(__('Database %1$s has been created.'));
45 $message->addParam($new_db);
46 $GLOBALS['db'] = $new_db;
48 require_once './libraries/header.inc.php';
49 require_once './' . $cfg['DefaultTabDatabase'];