<?php
$changes = 0; $error = 0;
$result = dbquery("SHOW COLUMNS FROM ".$db_prefix."site_links LIKE 'link_parent'");
if (dbrows($result) == 0) {
$result = dbquery("ALTER TABLE ".$db_prefix."site_links ADD link_parent SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER link_id");
if ($result) {
$result = dbquery("INSERT INTO ".$db_prefix."site_links
(link_parent, link_name, link_url, link_visibility, link_position, link_window, link_order)
VALUES ('0', 'Home', 'icon_home.gif', '0', '1', '0', '1')"
);
$parent = mysql_insert_id();
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_parent='$parent' WHERE link_id!='$parent'");
$changes = 1;
} else {
echo "<p align='center'><font color='red'><b>ERROR:</b></font> The link_parent column was not added.</p>";
$error ++;
}
} else { $changes = 1; }
if ($changes != 0) {
$result = dbquery("SHOW COLUMNS FROM ".$db_prefix."site_links LIKE 'link_accessibility'");
if (dbrows($result) == 0) {
$result = dbquery("ALTER TABLE ".$db_prefix."site_links ADD link_accessibility TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER link_visibility");
if ($result) {
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_accessibility=link_visibility");
} else {
echo "<p align='center'><font color='red'><b>ERROR:</b></font> The link_accessibility column was not added.</p>";
$error ++;
}
}
}
$result = dbquery("SHOW COLUMNS FROM ".$db_prefix."site_links LIKE 'link_collapse'");
if (dbrows($result) == 0) {
$result = dbquery("ALTER TABLE ".$db_prefix."site_links ADD link_collapse TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER link_accessibility");
if (!$result) {
echo "<p align='center'><font color='red'><b>ERROR:</b></font> The link_collapse column was not added.</p>";
$error ++;
}
}
if ($error == 0) { echo "<p align='center'>Table alterations are complete.</p>"; }
?>
Category Forum
Suspected Bugs and Errors - 8Labels
None yet
Statistics
1 participant
Notifications
You are not receiving notifications from this thread.
Related Questions