diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-19 18:16:25 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-19 18:16:25 +0000 |
commit | bb73a2d896ba7686a4af8a0382c7bc8487e1ef16 (patch) | |
tree | 1a517319e599db4810331f13a8c5a88ad8c83a94 | |
parent | ebd811415a29143db44cd6d32c5f2f0769dc8fc7 (diff) |
Replace mysql_create_db with a mysql_query() call as recommended by the PHP manual.
-rw-r--r-- | installer/installer.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/installer/installer.php b/installer/installer.php index 9279613b..9a3f83f9 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -146,12 +146,13 @@ class installer { return; } - if (!mysql_select_db($config["dbname"]) && - !function_exists("mysql_create_db") || - !mysql_create_db($config["dbname"])) { - $errors["Database"] = sprintf( - "Database '%s' is not defined and can't be created", - $config["dbname"]); + if (!mysql_select_db($config["dbname"])) { + if (!(mysql_query("CREATE DATABASE {$config['dbname']}") && + mysql_select_db($config["dbname"]))) { + $errors["Database"] = sprintf( + "Database '%s' is not defined and can't be created", + $config["dbname"]); + } } if (empty($errors) && mysql_num_rows(mysql_query("SHOW TABLES FROM {$config['dbname']}"))) { |