Skip to content

Commit

Permalink
mysql_error to $databasee->error()
Browse files Browse the repository at this point in the history
I hope this is a good idea and the right replacement
  • Loading branch information
NorHei committed Nov 6, 2016
1 parent 9210c2a commit 8a5bafe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions wbce/modules/sitemap/upgrade.php
Expand Up @@ -62,15 +62,15 @@
if (!array_key_exists('sitemaploop', $items)){
if ($database->query("ALTER TABLE `".$dbtable."` CHANGE `loop` `sitemaploop` TEXT NOT NULL")) {
echo '<span class="good">Database field <i>loop</i> renamed to <i>sitemaploop</i> successfully</span><br />';
} else { echo '<span class="bad">'.mysql_error().'</span><br />'; $result = 1;}
} else { echo '<span class="bad">'.$database->error().'</span><br />'; $result = 1;}
} else { echo '<span class="ok">Database field <i>sitemaploop</i> already exists, update not needed.</span><br />';}

echo "<BR><B>Trying to add database field '<i>show_hidden</i>'...</B><BR>";

if (!array_key_exists('show_hidden', $items)){
if ($database->query("ALTER TABLE `".$dbtable."` ADD `show_hidden` INT NOT NULL")) {
echo '<span class="good">Database field <i>show_hidden</i> added successfully</span><br />';
} else { echo '<span class="bad">'.mysql_error().'</span><br />'; $result = 1;}
} else { echo '<span class="bad">'.$database->error().'</span><br />'; $result = 1;}
} else { echo '<span class="ok">Database field <i>show_hidden</i> already exists, update not needed.</span><br />'; }

if($result == 1) die();
Expand Down
12 changes: 6 additions & 6 deletions wbce/modules/topics/inc/upgrade.inc.php
Expand Up @@ -15,7 +15,7 @@
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_".$tablename."` ADD `authors` VARCHAR(255) NOT NULL DEFAULT ''")) {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "authors" added successfully</div><br />';
}
echo '<div style="color:#e92a0b; font-weight:bold;">'.mysql_error().'</div><br />';
echo '<div style="color:#e92a0b; font-weight:bold;">'.$database->error().'</div><br />';
} else {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "authors" exists, update not needed</div><br />';
}
Expand All @@ -31,7 +31,7 @@
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_".$tablename."` ADD `comments_count` INT NOT NULL DEFAULT '-1'")) {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "comments_count" added successfully</div><br />';
}
echo '<div style="color:#e92a0b; font-weight:bold;">'.mysql_error().'</div><br />';
echo '<div style="color:#e92a0b; font-weight:bold;">'.$database->error().'</div><br />';
} else {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "comments_count" exists, update not needed</div><br />';
}
Expand All @@ -55,7 +55,7 @@
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_".$tablename."_settings` ADD `various_values` VARCHAR(255) NOT NULL DEFAULT '150,450,0,0,2,0,0,0,0,0'")) {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "various_values" added successfully</div><br />';
}
echo '<div style="color:#e92a0b; font-weight:bold;">'.mysql_error().'</div><br />';
echo '<div style="color:#e92a0b; font-weight:bold;">'.$database->error().'</div><br />';
} else {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "various_values" exists, update not needed</div><br />';
}
Expand All @@ -71,7 +71,7 @@
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_".$tablename."_settings` ADD `autoarchive` VARCHAR(255) NOT NULL DEFAULT ''")) {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "autoarchive" added successfully</div><br />';
}
echo '<div style="color:#e92a0b; font-weight:bold;">'.mysql_error().'</div><br />';
echo '<div style="color:#e92a0b; font-weight:bold;">'.$database->error().'</div><br />';
} else {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "autoarchive" exists, update not needed</div><br />';
}
Expand All @@ -87,7 +87,7 @@
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_".$tablename."_settings` ADD `picture_values` VARCHAR(255) NOT NULL DEFAULT '0,0,300,0,70,70,fbx'")) {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "picture_values" added successfully</div><br />';
}
echo '<div style="color:#e92a0b; font-weight:bold;">'.mysql_error().'</div><br />';
echo '<div style="color:#e92a0b; font-weight:bold;">'.$database->error().'</div><br />';
} else {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "picture_values" exists, update not needed</div><br />';
}
Expand All @@ -103,7 +103,7 @@
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_".$tablename."_settings` ADD `is_master_for` VARCHAR(255) NOT NULL DEFAULT ''")) {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "is_master_for" added successfully</div><br />';
}
echo '<div style="color:#e92a0b; font-weight:bold;">'.mysql_error().'</div><br />';
echo '<div style="color:#e92a0b; font-weight:bold;">'.$database->error().'</div><br />';
} else {
echo '<div style="color:#0bb61f; font-weight:bold;">Database Field "is_master_for" exists, update not needed</div><br />';
}
Expand Down
4 changes: 2 additions & 2 deletions wbce/modules/topics/upgrade.php
Expand Up @@ -38,7 +38,7 @@
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_".$mod_dir."` ADD `groups_id` VARCHAR(255) NOT NULL DEFAULT ''")) {
echo '<span class="good">Database Field groups_id added successfully</span><br />';
}
echo '<span class="bad">'.mysql_error().'</span><br />';
echo '<span class="bad">'.$database->error().'</span><br />';
} else {
echo '<span class="ok">Database Field groups_id exists, update not needed</span><br />';
}
Expand All @@ -50,7 +50,7 @@
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_".$mod_dir."_comments` ADD `commentextra` VARCHAR(255) NOT NULL DEFAULT ''")) {
echo '<span class="good">Database Field commentextra added successfully</span><br />';
}
echo '<span class="bad">'.mysql_error().'</span><br />';
echo '<span class="bad">'.$database->error().'</span><br />';
} else {
echo '<span class="ok">Database Field commentextra exists, update not needed</span><br />';
}
Expand Down

0 comments on commit 8a5bafe

Please sign in to comment.