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