$hostname = 'localhost';
$dbname = 'test';
$username = 'root';
$pw = 'vivian';
$sqlfile = 'gb.sql';
$sql = file_get_contents($sqlfile);
echo($dbname);
echo($sql);
$conn = mysql_connect($hostname,$username,$pw) or die("无法连接数据库");
mysql_select_db($dbname,$conn) or die("无法连接到数据库");
mysql_query($sql) or die(mysql_error());
?>
<font face="新宋体">-- -----------------------------------------------------------<br>
--<br>
-- Guest Book SQL File for installation <br>
-- $id : gb.sql 1 2008-7-16 iwege $<br>
--<br>
-- -----------------------------------------------------------<br>
DROP TABLE IF EXISTS gb_comments;<br>
CREATE TABLE gb_comments(<br>
cid mediumint(8) NOT NULL AUTO_INCREMENT,<br>
username char(15) NOT NULL DEFAULT 'zero',<br>
email char(40),<br>
website varchar(75),<br>
passdate datetime NOT NULL,<br>
title varchar(75) NOT NULL,<br>
message text NOT NULL,<br>
PRIMARY KEY (cid)<br>
)TYPE=MyISAM DEFAULT CHARSET=gbk;</font>
--
-- Guest Book SQL File for installation
-- $id : gb.sql 1 2008-7-16 iwege $
--