diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-06 10:11:03 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-06 10:11:03 -0800 |
commit | 7778d4c05075e67f096d3d5365e5ae35e1b0a737 (patch) | |
tree | b3121dd92e8e70d41b5a6a4bc81d8d35112f5714 /installer/installer.php | |
parent | c5d14438959346551765757a506689a7d8b13665 (diff) |
Provide an error message when the sql in installer::empty_db fails. Also change the show tables not to specify a database as it will use the database in the active connection. Fixes ticket #963.
Diffstat (limited to 'installer/installer.php')
-rw-r--r-- | installer/installer.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/installer/installer.php b/installer/installer.php index e2c60d46..57be6cc0 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -107,7 +107,7 @@ class installer { return true; } - return mysql_query("CREATE DATABASE {$config['dbname']}") && + return mysql_query("CREATE DATABASE `{$config['dbname']}`") && mysql_select_db($config["dbname"]); } @@ -122,8 +122,13 @@ class installer { } static function db_empty($config) { - $query = "SHOW TABLES IN {$config['dbname']} LIKE '{$config['prefix']}items'"; - return mysql_num_rows(mysql_query($query)) == 0; + $query = "SHOW TABLES LIKE '{$config['prefix']}items'"; + $results = mysql_query($query); + if ($results === false) { + $msg = mysql_error(); + return $msg; + } + return mysql_num_rows($results) === 0; } static function create_admin($config) { |