如何使用JSP+MySQL创建留言本(一)
如何使用JSP+MySQL创建留言本(一),如何使用JSP+MySQL创建留言本(一)
数据库的结构为:
+-----------+-------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------------------+----------------+
| userid | int(11) | | PRI | 0 | auto_increment |
| username | char(20) | | | | |
| sex | char(2) | | | | |
| address | char(40) | YES | | NULL | |
| ip | char(15) | | | | |
| post | int(11) | YES | | 0 | |
| oicq | int(11) | YES | | 0 | |
| icq | int(11) | YES | | 0 | |
| telnumber | char(30) | YES | | NULL | |
| comment | text | | | NULL | |
| time | datetime | | | 0000-00-00 00:00:00 | |
+-----------+-------------+------+-----+---------------------+----------------+
如果你认为建立数据库太麻烦的话
建立数据库的语句为:
DROP DATABASE IF EXISTS pinghui;
CREATE DATABASE pinghui;
USE pinghui;
CREATE TABLE comment(
userid int NOT NULL DEFAULT 0 AUTO_INCREMENT PRIMARY KEY,
username char(20) NOT NULL,
sex char(2),
address char(40),
ip char(15) NOT NULL,
post int DEFAULT 0,
oicq int DEFAULT 0,
icq int DEFAULT 0,
telnumber char(30),
comment text NOT NULL,
time datetime NOT NULL
);
INSERT INTO comment (username,ip,comment,time) VALUES ("pinghui","127.0.0.1",
"你好,请到萍慧自由空间查看信息!",now());
insert into comment (username,sex,address,ip,post,oicq,icq,telnumber,comment,time)
values ('pinghui','男','地址','127.0.0.1',250100,2269101,74875874,'0531-8605449',