} catch (Exception $err) {
$e[] = "Got the following database connection error! <code>" . $err->getMessage() . "</code> Please make sure that your database settings are correct and that the database server is running and then try again.";
}
if (!$e && !$db) {
$e[] = "Got the following database connection error! <code>" . $db->error() . "</code> Please make sure that your database settings are correct and that the database server is running and then try again.";
}
if (!$e && !$GLOBALS['error']) {
// If we get a database error, it'll activate $GLOBALS['error'] through PHP error
$log[] = "Connected to MySQL database!";
$cv = $db->clientVersion();
if (version_compare($cv, "4.1.0", "<")) {
$e[] = "Your MySQL client version is too old. Tweet Nest requires MySQL version 4.1 or higher to function. Your client currently has " . s($cv) . ".";
} else {
$log[] = "MySQL client version: " . $cv;
}
$sv = $db->serverVersion();
if (version_compare($sv, "4.1.0", "<")) {
$e[] = "Your MySQL server version is too old. Tweet Nest requires MySQL version 4.1 or higher to function. Your server currently has " . s($sv) . ".";
} else {
$log[] = "MySQL server version: " . $sv;
}
if (!$e) {
// Set up the database!
$log[] = "Acceptable MySQL version.";
$DTP = $_POST['db_table_prefix'];
// This has been verified earlier on in the code
// Tweets table
$q = $db->query("CREATE TABLE `" . $DTP . "tweets` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `userid` int(10) unsigned NOT NULL, `tweetid` bigint(20) unsigned NOT NULL, `type` tinyint(4) NOT NULL DEFAULT '0', `time` int(10) unsigned NOT NULL, `text` varchar(255) NOT NULL, `source` varchar(255) NOT NULL, `favorite` tinyint(4) NOT NULL DEFAULT '0', `extra` text NOT NULL, `coordinates` text NOT NULL, `geo` text NOT NULL, `place` text NOT NULL, `contributors` text NOT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `text` (`text`)) ENGINE=MyISAM DEFAULT CHARSET=utf8");
if (!$q) {
$e[] = "An error occured while creating table <code>" . $DTP . "tweets</code>: <code>" . $db->error() . "</code>";
} else {