[*] IN : only display the button to create the database if you can actually create the database

This commit is contained in:
Damien Metzger
2013-07-03 11:28:55 +02:00
parent bfa2f33c65
commit 5789e6eb51
4 changed files with 23 additions and 13 deletions
+5 -2
View File
@@ -47,10 +47,13 @@ class MySQLCore extends Db
return $this->link;
}
public static function createDatabase($host, $user, $password, $dbname)
public static function createDatabase($host, $user, $password, $dbname, $dropit = false)
{
$link = mysql_connect($host, $user, $password);
return mysql_query('CREATE DATABASE `'.bqSQL($dbname).'`');
$success = mysql_query('CREATE DATABASE `'.bqSQL($dbname).'`', $link);
if ($dropit)
$success &= mysql_query('DROP DATABASE `'.bqSQL($dbname).'`', $link);
return $success;
}
/**