Location: PHPKode > projects > phpBook > doc/update_1.50-1.60.php
<?
#######################################################################################
# 
# File to upgrade phpBook from 1.50 to 1.60
#   Enter SQL Info to your Datebase below..
# DELETE THIS FILE AFTER UPDATING
$host       = "localhost";
$database   = "phpBook";
$username   = "mysql_username";
$password   = "mysql_password";
#
#######################################################################################


mysql_connect($host, $username, $password) or die ("Database connect Error");
    @mysql_select_db($database) or die ("Database select Error");

$result = mysql_query("UPDATE guestbook SET email = NULL WHERE email = 'none'");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("UPDATE guestbook SET icq = NULL WHERE icq = 0");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("UPDATE guestbook SET http = NULL WHERE http = 'none'");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("UPDATE guestbook SET location = NULL WHERE location = 'none'");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE guestbook ADD hide_email ENUM('TRUE') AFTER email");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE guestbook ADD jabber VARCHAR(35) AFTER hide_email");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE guestbook ADD msn VARCHAR(35) AFTER icq");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE guestbook ADD aim VARCHAR(35) AFTER msn");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE guestbook ADD yahoo VARCHAR(35) AFTER aim");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE guestbook MODIFY email VARCHAR(35)");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE guestbook MODIFY icq INT(11)");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE guestbook MODIFY http VARCHAR(50)");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE guestbook MODIFY location VARCHAR(35)");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE guestbook MODIFY comment MEDIUMTEXT");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}
unset($result);

$result = mysql_query("ALTER TABLE smilies MODIFY file VARCHAR(20)");
if (!$result) {
    echo "Alteration of guestbook table failed!<br>" .mysql_errno(). ": ".mysql_error(). "<br>";
    return;
}


echo "phpBook Tables Updated, Ok...";
?>
Return current item: phpBook