明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

用IE遠(yuǎn)程創(chuàng)建Mysql數(shù)據(jù)庫(kù)的簡(jiǎn)易程序

[摘要]小生近日來(lái)學(xué)習(xí)Mysql數(shù)據(jù)庫(kù),自己編寫一個(gè)用IE遠(yuǎn)程創(chuàng)建Mysql數(shù)據(jù)庫(kù)的簡(jiǎn)易程序,此程序適用與對(duì)Mysql數(shù)據(jù)庫(kù)一無(wú)所知的人,可以輕松的創(chuàng)建Mysql數(shù)據(jù)庫(kù)及數(shù)據(jù)庫(kù)中的各種類型的表,而且完全是圖形界面,你甚至可以一句sql語(yǔ)句都不知道,我編寫的這個(gè)程序可能尚還十分簡(jiǎn)陋,在此我只想起一個(gè)拋磚引玉...
小生近日來(lái)學(xué)習(xí)Mysql數(shù)據(jù)庫(kù),自己編寫一個(gè)用IE遠(yuǎn)程創(chuàng)建Mysql數(shù)據(jù)庫(kù)的簡(jiǎn)易程序,此程序適用與對(duì)Mysql數(shù)據(jù)庫(kù)一無(wú)所知的人,可以輕松的創(chuàng)建Mysql數(shù)據(jù)庫(kù)及數(shù)據(jù)庫(kù)中的各種類型的表,而且完全是圖形界面,你甚至可以一句sql語(yǔ)句都不知道,我編寫的這個(gè)程序可能尚還十分簡(jiǎn)陋,在此我只想起一個(gè)拋磚引玉的作用,希望大家能不斷完善此程序,做一個(gè)真正意義上的圖形界面的Mysql管理器.
此程序共分兩個(gè)文件:
mkdb.htm:搜集使用者信息,給下面的.php文件使用.
<HTML>
<HEAD>
<TITLE>MYSQL數(shù)據(jù)庫(kù)創(chuàng)建單</TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="MKDB.PHP">
<TABLE WIDTH=400 BORDER=1 CELLSPACING=0 CELLPADDING=0>
<TR>
    <TD ALIGN=CENTER COLSPAN=2>創(chuàng)建一個(gè)新的數(shù)據(jù)庫(kù)</TD>
</TR>
<TR>
    <TD WIDTH=150 ALIGN=CENTER>請(qǐng)輸入數(shù)據(jù)庫(kù)名:</TD>
    <TD WIDTH=250 ALIGN=CENTER>
        <INPUT TYPE=TEST SIZE=30 VALUE=DATABASE NAME=DATABASENAME>
    </TD>
</TR>
<TR>
    <TD ALIGN=CENTER COLSPAN=2>
        <INPUT TYPE=SUBMIT VALUE=創(chuàng)建數(shù)據(jù)庫(kù) NAME=SWCODE>
    </TD>
</TR>
</TABLE>
</FORM>
<FORM METHOD="POST" ACTION="MKDB.PHP">
<TABLE WIDTH=400 BORDER=1 cellspacing=0 cellpadding=0>
<TR>
    <TD ALIGN=CENTER COLSPAN=2>刪除一個(gè)已有的數(shù)據(jù)庫(kù)</TD>
</TR>
<TR>
    <TD WIDTH=150 ALIGN=CENTER>請(qǐng)輸入數(shù)據(jù)庫(kù)名:</TD>
    <TD WIDTH=250 ALIGN=CENTER>
        <INPUT TYPE=TEST SIZE=30 VALUE=DATABASE NAME=DATABASENAME>
    </TD>
</TR>
<TR>
    <TD ALIGN=CENTER COLSPAN=2>
        <INPUT TYPE=SUBMIT VALUE=刪除數(shù)據(jù)庫(kù) NAME=SWCODE>
    </TD>
</TR>
</TABLE>
</FORM>
<FORM METHOD="POST" ACTION="MKDB.PHP">
<TABLE WIDTH=500 BORDER=1 cellspacing=0 cellpadding=0>
<TR>
    <TD ALIGN=CENTER COLSPAN=2>在一個(gè)已有的數(shù)據(jù)庫(kù)中創(chuàng)建表</TD>
</TR>
<TR>
    <TD WIDTH=150 ALIGN=CENTER>請(qǐng)輸入數(shù)據(jù)庫(kù)名:</TD>
    <TD WIDTH=350>
        <INPUT TYPE=TEST SIZE=30 VALUE=DATABASE NAME=DATABASENAME>
    </TD>
</TR>
<TR>
    <TD WIDTH=150 ALIGN=CENTER>請(qǐng)輸入表名:</TD>
    <TD WIDTH=350>
        <INPUT TYPE=TEST SIZE=30 VALUE=TESTABLE NAME=TABLENAME>
    </TD>
</TR>
<TR>
    <TD ALIGN=CENTER COLSPAN=2>
        <TABLE WIDTH=500 BORDER=1 cellspacing=0 cellpadding=0>
        <TR>
            <TD WIDTH=75 ALIGN=CENTER>字段名</TD>
            <TD WIDTH=175 ALIGN=CENTER><INPUT TYPE=TEST SIZE=20 VALUE=IDX NAME=FIELDNAME[1]></TD>
            <TD WIDTH=75 ALIGN=CENTER>字段類型</TD>
            <TD WIDTH=175 ALIGN=CENTER>
            <SELECT NAME=TYPE[1] SIZE=1>
            <OPTION VALUE=INTEGER(10) SELECTED>普通整型</OPTION>
            <OPTION VALUE=TINYINT(3)>短整型</OPTION>
            <OPTION VALUE=FLOAT(10,4)>單精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DOUBLE(10,4)>雙精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DATE>日期型</OPTION>
            <OPTION VALUE=VARCHAR(255)>可變字符型</OPTION>
            <OPTION VALUE=CHAR(20)>字符型(20個(gè)字符)</OPTION>
            </SELECT>
            </TD>
        </TR>
        <TR>
            <TD WIDTH=75 ALIGN=CENTER>字段名</TD>
            <TD WIDTH=175 ALIGN=CENTER><INPUT TYPE=TEST SIZE=20 NAME=FIELDNAME[2]></TD>
            <TD WIDTH=75 ALIGN=CENTER>字段類型</TD>
            <TD WIDTH=175 ALIGN=CENTER>
            <SELECT NAME=TYPE[2] SIZE=1>
            <OPTION VALUE=INTEGER(10)>普通整型</OPTION>
            <OPTION VALUE=TINYINT(3)>短整型</OPTION>
            <OPTION VALUE=FLOAT(10,4)>單精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DOUBLE(10,4)>雙精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DATE>日期型</OPTION>
            <OPTION VALUE=VARCHAR(255)>可變字符型</OPTION>
            <OPTION VALUE=CHAR(20)>字符型(20個(gè)字符)</OPTION>
            <OPTION VALUE=NONE SELECTED>空字段</OPTION>
            </SELECT>
            </TD>
        </TR>
        <TR>
            <TD WIDTH=75 ALIGN=CENTER>字段名</TD>
            <TD WIDTH=175 ALIGN=CENTER><INPUT TYPE=TEST SIZE=20 NAME=FIELDNAME[3]></TD>
            <TD WIDTH=75 ALIGN=CENTER>字段類型</TD>
            <TD WIDTH=175 ALIGN=CENTER>
            <SELECT NAME=TYPE[3] SIZE=1>
            <OPTION VALUE=INTEGER(10)>普通整型</OPTION>
            <OPTION VALUE=TINYINT(3)>短整型</OPTION>
            <OPTION VALUE=FLOAT(10,4)>單精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DOUBLE(10,4)>雙精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DATE>日期型</OPTION>
            <OPTION VALUE=VARCHAR(255)>可變字符型</OPTION>
            <OPTION VALUE=CHAR(20)>字符型(20個(gè)字符)</OPTION>
            <OPTION VALUE=NONE SELECTED>空字段</OPTION>
            </SELECT>
            </TD>
        </TR>
        <TR>
            <TD WIDTH=75 ALIGN=CENTER>字段名</TD>
            <TD WIDTH=175 ALIGN=CENTER><INPUT TYPE=TEST SIZE=20 NAME=FIELDNAME[4]></TD>
            <TD WIDTH=75 ALIGN=CENTER>字段類型</TD>
            <TD WIDTH=175 ALIGN=CENTER>
            <SELECT NAME=TYPE[4] SIZE=1>
            <OPTION VALUE=INTEGER(10)>普通整型</OPTION>
            <OPTION VALUE=TINYINT(3)>短整型</OPTION>
            <OPTION VALUE=FLOAT(10,4)>單精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DOUBLE(10,4)>雙精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DATE>日期型</OPTION>
            <OPTION VALUE=VARCHAR(255)>可變字符型</OPTION>
            <OPTION VALUE=CHAR(20)>字符型(20個(gè)字符)</OPTION>
            <OPTION VALUE=NONE SELECTED>空字段</OPTION>
            </SELECT>
            </TD>
        </TR>
        <TR>
            <TD WIDTH=75 ALIGN=CENTER>字段名</TD>
            <TD WIDTH=175 ALIGN=CENTER><INPUT TYPE=TEST SIZE=20 NAME=FIELDNAME[5]></TD>
            <TD WIDTH=75 ALIGN=CENTER>字段類型</TD>
            <TD WIDTH=175 ALIGN=CENTER>
            <SELECT NAME=TYPE[5] SIZE=1>
            <OPTION VALUE=INTEGER(10)>普通整型</OPTION>
            <OPTION VALUE=TINYINT(3)>短整型</OPTION>
            <OPTION VALUE=FLOAT(10,4)>單精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DOUBLE(10,4)>雙精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DATE>日期型</OPTION>
            <OPTION VALUE=VARCHAR(255)>可變字符型</OPTION>
            <OPTION VALUE=CHAR(20)>字符型(20個(gè)字符)</OPTION>
            <OPTION VALUE=NONE SELECTED>空字段</OPTION>
            </SELECT>
            </TD>
        </TR>
        <TR>
            <TD WIDTH=75 ALIGN=CENTER>字段名</TD>
            <TD WIDTH=175 ALIGN=CENTER><INPUT TYPE=TEST SIZE=20 NAME=FIELDNAME[6]></TD>
            <TD WIDTH=75 ALIGN=CENTER>字段類型</TD>
            <TD WIDTH=175 ALIGN=CENTER>
            <SELECT NAME=TYPE[6] SIZE=1>
            <OPTION VALUE=INTEGER(10)>普通整型</OPTION>
            <OPTION VALUE=TINYINT(3)>短整型</OPTION>
            <OPTION VALUE=FLOAT(10,4)>單精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DOUBLE(10,4)>雙精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DATE>日期型</OPTION>
            <OPTION VALUE=VARCHAR(255)>可變字符型</OPTION>
            <OPTION VALUE=CHAR(20)>字符型(20個(gè)字符)</OPTION>
            <OPTION VALUE=NONE SELECTED>空字段</OPTION>
            </SELECT>
            </TD>
        </TR>
        <TR>
            <TD WIDTH=75 ALIGN=CENTER>字段名</TD>
            <TD WIDTH=175 ALIGN=CENTER><INPUT TYPE=TEST SIZE=20 NAME=FIELDNAME[7]></TD>
            <TD WIDTH=75 ALIGN=CENTER>字段類型</TD>
            <TD WIDTH=175 ALIGN=CENTER>
            <SELECT NAME=TYPE[7] SIZE=1>
            <OPTION VALUE=INTEGER(10)>普通整型</OPTION>
            <OPTION VALUE=TINYINT(3)>短整型</OPTION>
            <OPTION VALUE=FLOAT(10,4)>單精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DOUBLE(10,4)>雙精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DATE>日期型</OPTION>
            <OPTION VALUE=VARCHAR(255)>可變字符型</OPTION>
            <OPTION VALUE=CHAR(20)>字符型(20個(gè)字符)</OPTION>
            <OPTION VALUE=NONE SELECTED>空字段</OPTION>
            </SELECT>
            </TD>
        </TR>
        <TR>
            <TD WIDTH=75 ALIGN=CENTER>字段名</TD>
            <TD WIDTH=175 ALIGN=CENTER><INPUT TYPE=TEST SIZE=20 NAME=FIELDNAME[8]></TD>
            <TD WIDTH=75 ALIGN=CENTER>字段類型</TD>
            <TD WIDTH=175 ALIGN=CENTER>
            <SELECT NAME=TYPE[8] SIZE=1>
            <OPTION VALUE=INTEGER(10)>普通整型</OPTION>
            <OPTION VALUE=TINYINT(3)>短整型</OPTION>
            <OPTION VALUE=FLOAT(10,4)>單精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DOUBLE(10,4)>雙精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DATE>日期型</OPTION>
            <OPTION VALUE=VARCHAR(255)>可變字符型</OPTION>
            <OPTION VALUE=CHAR(20)>字符型(20個(gè)字符)</OPTION>
            <OPTION VALUE=NONE SELECTED>空字段</OPTION>
            </SELECT>
            </TD>
        </TR>
        <TR>
            <TD WIDTH=75 ALIGN=CENTER>字段名</TD>
            <TD WIDTH=175 ALIGN=CENTER><INPUT TYPE=TEST SIZE=20 NAME=FIELDNAME[9]></TD>
            <TD WIDTH=75 ALIGN=CENTER>字段類型</TD>
            <TD WIDTH=175 ALIGN=CENTER>
            <SELECT NAME=TYPE[9] SIZE=1>
            <OPTION VALUE=INTEGER(10)>普通整型</OPTION>
            <OPTION VALUE=TINYINT(3)>短整型</OPTION>
            <OPTION VALUE=FLOAT(10,4)>單精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DOUBLE(10,4)>雙精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DATE>日期型</OPTION>
            <OPTION VALUE=VARCHAR(255)>可變字符型</OPTION>
            <OPTION VALUE=CHAR(20)>字符型(20個(gè)字符)</OPTION>
            <OPTION VALUE=NONE SELECTED>空字段</OPTION>
            </SELECT>
            </TD>
        </TR>
        <TR>
            <TD WIDTH=75 ALIGN=CENTER>字段名</TD>
            <TD WIDTH=175 ALIGN=CENTER><INPUT TYPE=TEST SIZE=20 NAME=FIELDNAME[10]></TD>
            <TD WIDTH=75 ALIGN=CENTER>字段類型</TD>
            <TD WIDTH=175 ALIGN=CENTER>
            <SELECT NAME=TYPE[10] SIZE=1>
            <OPTION VALUE=INTEGER(10)>普通整型</OPTION>
            <OPTION VALUE=TINYINT(3)>短整型</OPTION>
            <OPTION VALUE=FLOAT(10,4)>單精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DOUBLE(10,4)>雙精度浮點(diǎn)型</OPTION>
            <OPTION VALUE=DATE>日期型</OPTION>
            <OPTION VALUE=VARCHAR(255)>可變字符型</OPTION>
            <OPTION VALUE=CHAR(20)>字符型(20個(gè)字符)</OPTION>
            <OPTION VALUE=NONE SELECTED>空字段</OPTION>
            </SELECT>
            </TD>
        </TR>
        </TABLE>
    </TD>
</TR>
<TR>
    <TD ALIGN=CENTER COLSPAN=2>
        <INPUT TYPE=SUBMIT VALUE=創(chuàng)建表 NAME=SWCODE>
    </TD>
</TR>
</TABLE>
</FORM>
<FORM METHOD="POST" ACTION="MKDB.PHP">
<TABLE WIDTH=400 BORDER=1 CELLSPACING=0 CELLPADDING=0>
<TR>
    <TD ALIGN=CENTER COLSPAN=2>刪除一張已有的表</TD>
</TR>
<TR>
    <TD WIDTH=150 ALIGN=CENTER>請(qǐng)輸入數(shù)據(jù)庫(kù)名:</TD>
    <TD WIDTH=250 ALIGN=CENTER>
        <INPUT TYPE=TEST SIZE=30 VALUE=DATABASE NAME=DATABASENAME>
    </TD>
</TR>
<TR>
    <TD WIDTH=150 ALIGN=CENTER>請(qǐng)輸入表格名稱:</TD>
    <TD WIDTH=250 ALIGN=CENTER>
        <INPUT TYPE=TEST SIZE=30 VALUE=TESTABLE NAME=TABLENAME>
    </TD>
</TR>
<TR>
    <TD ALIGN=CENTER COLSPAN=2>
        <INPUT TYPE=SUBMIT VALUE=刪除表 NAME=SWCODE>
    </TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>



mkdb.php:通過(guò)函數(shù)聯(lián)系mysql.

<HTML>
<HEAD>
<TITLE>MYSQL數(shù)據(jù)庫(kù)創(chuàng)建結(jié)果</TITLE>
<?php
function showdb($result)
{
    echo "<CENTER><TABLE BORDER=1 WIDTH=350 CELLSPACING=0 CELLPADDING=0>
    <TR>
        <TD WIDTH=100 ALIGN=CENTER>數(shù)據(jù)庫(kù)序號(hào)</TD>
        <TD WIDTH=250 ALIGN=CENTER>數(shù)據(jù)庫(kù)名</TD>
    </TR>";$i=0;
    while($row=mysql_fetch_array($result))
    {
        $i=$i+1;
        echo "<TR><TD WIDTH=100 ALIGN=CENTER>$i</TD>";
        echo "<TD WIDTH=250 ALIGN=CENTER>";
        echo $row["Database"];
        echo "</TD></TR></CENTER>";
    }
}
function showcol($result)
{
    echo "<CENTER><TABLE BORDER=1 WIDTH=350 CELLSPACING=0 CELLPADDING=0>
    <TR>
        <TD WIDTH=100 ALIGN=CENTER>字段名</TD>
        <TD WIDTH=250 ALIGN=CENTER>字段類型</TD>
    </TR>";$i=0;
    while($row=mysql_fetch_array($result))
    {
        echo "<TR><TD WIDTH=100 ALIGN=CENTER>";
        echo $row["Field"];
        echo "</TD>";
        echo "<TD WIDTH=250 ALIGN=CENTER>";
        echo $row["Type"];
        echo "</TD></TR></CENTER>";
    }
}
function showtab($result,$DATABASENAME)
{
    echo "<CENTER><TABLE BORDER=1 WIDTH=350 CELLSPACING=0 CELLPADDING=0>
    <TR>
        <TD WIDTH=100 ALIGN=CENTER>表格序號(hào)</TD>
        <TD WIDTH=250 ALIGN=CENTER>表格名稱</TD>
    </TR>";$i=0;
    while($row=mysql_fetch_array($result))
    {
        $i=$i+1;
        echo "<TR><TD WIDTH=100 ALIGN=CENTER>$i</TD>";
        echo "<TD WIDTH=250 ALIGN=CENTER>";
        echo $row["Tables_in_".$DATABASENAME];
        echo "</TD></TR></CENTER>";
    }
}
function creatdb($dbname)
{
    $result=mysql_create_db($dbname);
    if ($result){
        echo "<CENTER><TABLE BORDER=0 WIDTH=350 CELLSPACING=0 CELLPADDING=0><TR><TD ALIGN=CENTER>";
        echo "<H4>$dbname 創(chuàng)建成功!</H4>";
        echo "</TD></TR></TABLE></CENTER>";}
    else{
        echo "<CENTER><TABLE BORDER=0 WIDTH=350 CELLSPACING=0 CELLPADDING=0><TR><TD ALIGN=CENTER>";
        echo "<H4>創(chuàng)建失敗!</H4>";
        echo "</TD></TR></TABLE></CENTER>";}
}
function dropdb($dbname)
{
    $result=mysql_drop_db($dbname);
    if ($result){
        echo "<CENTER><TABLE BORDER=0 WIDTH=350 CELLSPACING=0 CELLPADDING=0><TR><TD ALIGN=CENTER>";
        echo "<H4>$dbname 成功刪除!</H4>";
        echo "</TD></TR></TABLE></CENTER>";}
    else{
        echo "<CENTER><TABLE BORDER=0 WIDTH=350 CELLSPACING=0 CELLPADDING=0><TR><TD ALIGN=CENTER>";
        echo "<H4>刪除失敗!</H4>";
        echo "</TD></TR></TABLE></CENTER>";}
}
?>
</HEAD>
<BODY>
<CENTER><H3>數(shù)據(jù)庫(kù)創(chuàng)建結(jié)果如下:</H3></CENTER>
<?php
$result=mysql_connect();
switch($SWCODE){
    case '創(chuàng)建數(shù)據(jù)庫(kù)':
        creatdb($DATABASENAME);
        echo "<CENTER><H4>目前數(shù)據(jù)庫(kù)列表如下:</H4></BR></CENTER>";
        $result=mysql_list_dbs();
        showdb($result);
        break;
    case '刪除數(shù)據(jù)庫(kù)':
        dropdb($DATABASENAME);
        echo "<CENTER><H4>目前數(shù)據(jù)庫(kù)列表如下:</H4></BR></CENTER>";
        $result=mysql_list_dbs();
        showdb($result);
        break;
    case '創(chuàng)建表':
        if (mysql_select_db($DATABASENAME))
        {
            if (mysql_db_query($DATABASENAME,"select * from $TABLENAME"))
                echo "<H4><CENTER>在數(shù)據(jù)庫(kù): $DATABASENAME 中已存在 $TABLENAME 表。請(qǐng)檢查表名稱!</CENTER></H4>";
            else
            {
                $string="CREATE TABLE ".$TABLENAME."(";
                if ($TYPE[1]<>"NONE")    $string=$string.$FIELDNAME[1]." ".$TYPE[1];
                for($i=2;$i<=10;$i++)
                {
                    if ($TYPE[$i]<>"NONE")    $string=$string.",".$FIELDNAME[$i]." ".$TYPE[$i];
                }
                $string=$string.")";
                $result=mysql_db_query($DATABASENAME,"$string");
                if ($result)
                {
                    echo  "<H4><CENTER>成功的在數(shù)據(jù)庫(kù): $DATABASENAME 中創(chuàng)建 $TABLENAME 表!</CENTER></H4>";
                    $result=mysql_db_query($DATABASENAME,"SHOW COLUMNS FROM $TABLENAME");
                    showcol($result);
                }
                else
                {
                    echo "<H4><CENTER>在數(shù)據(jù)庫(kù): $DATABASENAME 中創(chuàng)建 $TABLENAME 表的動(dòng)作失!請(qǐng)檢查原因!</CENTER></H4>";
                }
            }
        }
        else
            echo "<CENTER><H4>此數(shù)據(jù)庫(kù)不存在!請(qǐng)檢查數(shù)據(jù)庫(kù)名。</H4></BR></CENTER>";
        $result=mysql_db_query($DATABASENAME,"SHOW TABLES");
        if ($result)
        {
            echo "<CENTER><H5>在".$DATABASENAME."中已存在的表格如下所示:</H5></CENTER>";
            showtab($result,$DATABASENAME);
        }
        break;
    case '刪除表':
        if (mysql_select_db($DATABASENAME))
        {
            $result=mysql_db_query($DATABASENAME,"DROP TABLE $TABLENAME");
            if ($result)
            {
                echo "<CENTER><H3>已成功的在數(shù)據(jù)庫(kù)".$DATABASENAME."中將表".$TABLENAME."刪除</CENTER></H3>";
                $result=mysql_db_query($DATABASENAME,"SHOW TABLES");             
                if ($result)
                {
                    echo "<CENTER><H5>在".$DATABASENAME."中已存在的表格如下所示:</H5></CENTER>";
                    showtab($result,$DATABASENAME);
                }
            }
            else
            {
                echo "<CENTER><H3>在數(shù)據(jù)庫(kù)".$DATABASENAME."中未將表".$TABLENAME."刪除!</CENTER></H3>";
                $result=mysql_db_query($DATABASENAME,"SHOW TABLES");             
                if ($result)
                {
                    echo "<CENTER><H5>在".$DATABASENAME."中已存在的表格如下所示:</H5></CENTER>";
                    showtab($result,$DATABASENAME);
                }
            }
        }
        else
            echo "<CENTER><H3>數(shù)據(jù)庫(kù)".$DATABASENAME."不存在!</H3></CENTER>";
        break;
    default:
        echo "<center><h2>你什么事都沒(méi)干!</h2></center>";
        break;
}
?>
</BODY>
</HTML>

使用時(shí),需將著兩個(gè)文件分別放到Apache的訪問(wèn)目錄下,并用IE訪問(wèn)mkdb.html便可.