Exemplo n.º 1
0
    $DB_site->user = $dbuser;
    $DB_site->password = $dbpass;
    $DB_site->connect();
}
if ($_GET['step'] == 3) {
    echo "<div class=\"step3\">";
    /**
     * // ------------------------------ -------- ------------------------------ //
     * STEP 3
     * // ------------------------------ -------- ------------------------------ //
     */
    echo "<div class=\"creat\">";
    if ($_GET['reset'] == 1) {
        echo "<p>正在重置数据库...";
        $result = $DB_site->query("SHOW tables");
        while ($currow = $DB_site->fetch_array($result)) {
            $DB_site->query("DROP TABLE IF EXISTS {$currow['0']}");
        }
        echo "已成功</p>";
    }
    $DB_site->reporterror = 0;
    $query[] = "CREATE TABLE {$table1} (\n`id` INT( 3 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n`username` VARCHAR( 30 ) NOT NULL ,\n`password` VARCHAR( 30 ) NOT NULL\n) ENGINE = MYISAM ";
    $explain[] = "创建 {$table1} 数据表";
    $query[] = "CREATE TABLE {$table2} (\n`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n`ip` VARCHAR( 40 ) NULL DEFAULT NULL ,\n`content` VARCHAR( 100 ) NULL DEFAULT NULL ,\n`source` TEXT( 65500 ) NULL DEFAULT NULL ,\n`level` INT( 11 ) NOT NULL DEFAULT '1',\n`remove` INT( 11 ) NOT NULL DEFAULT '0',\n`date` DATETIME NULL DEFAULT NULL\n) ENGINE = MYISAM \n";
    $explain[] = "创建 {$table2} 数据表";
    $time = date('Y-m-d H:m:s');
    $query[] = "INSERT INTO {$table2} VALUES (1,'127.0.0.1', '这是一条测试数据', 'this is sourcecode', '1','','{$time}')";
    doqueries();
    echo "</div>";
    if ($DB_site->errno != 0) {
        echo "<div class=\"err\">";