以下论坛建表同理:
建立论坛版块表forums,结构如下:
mysql>CREATE TABLE `forums` (
->`ID` int(11) NOT NULL auto_increment,
->`forum_name` varchar(50) NOT NULL default '',
->`forum_description` varchar(200) NOT NULL default '',
->`last_post_author` varchar(50) NOT NULL default '',
->`last_post_time` datetime NOT NULL default '0000-00-00 00:00:00',
->`forum_order` tinyint(3) NOT NULL default '0',
->`isguest` tinyint(3) NOT NULL default '0',
->PRIMARY KEY (`ID`)
->);
运行成功后图如下所示:
建立用户表member,结构如下
mysql>CREATE TABLE `member` (
->`ID` int(11) NOT NULL auto_increment,
->`groupID` tinyint(3) NOT NULL default '0',
->`username` varchar(50) NOT NULL default '',
->`real_name` varchar(50) NOT NULL default '',
->`password` varchar(50) NOT NULL default '',
->`email` varchar(50) NOT NULL default '',
->`headimg` varchar(50) NOT NULL default '',
->`homepage` varchar(50) default NULL,
->`qq` varchar(10) default NULL,
->`MSN` varchar(50) default NULL,
->`jointime` datetime NOT NULL default '0000-00-00 00:00:00',
->`no_of_post` smallint(6) default NULL,
->`sign` varchar(200) default NULL,
->PRIMARY KEY (`ID`)
->);
建立主题表tioic,如下:
mysql>CREATE TABLE `topic` (
->`ID` int(11) NOT NULL auto_increment,
->`title` varchar(100) NOT NULL default '',
->`author` varchar(50) NOT NULL default '',
->`last_post_author` varchar(50) default NULL,
->`last_post_time` datetime NOT NULL default '0000-00-00 00:00:00',
->`no_of_hit` smallint(6) NOT NULL default '0',
->`no_of_reply` mediumint(9) NOT NULL default '0',
->`locked` tinyint(3) NOT NULL default '0',
->`face` varchar(50) default NULL,
->`topic` tinyint(3) NOT NULL default '0',
->`good` tinyint(3) NOT NULL default '0',
->`forum_id` mediumint(9) NOT NULL default '0',
->PRIMARY KEY (`ID`)
->);
建立帖子表thread,结构如下:
mysql>CREATE TABLE `thread` (
->`ID` int(11) NOT NULL auto_increment,
->`topicID` smallint(6) NOT NULL default '0',
->`face` varchar(50) default NULL,
->`title` varchar(100) default NULL,
->`author` varchar(50) NOT NULL default '',
->`post_time` datetime NOT NULL default '0000-00-00 00:00:00',
->`subject` mediumtext NOT NULL,
->PRIMARY KEY (`ID`)
->);
标签: