(JSP + MySQL database to create a message book, first to create a MySQL database, on the use of MySQL Please download the http://pinghui.51.net/download/012mysql.chm tutorial. Now, for the purpose of illustration, we assume that the database has been created and the database name is pinghui, where the comment table records the message.
the database structure is:
+ ----------- + ------------- + ------ + ----- + ------------------- + ---------------- +
| FIELD | type | null | key | default | extra |
+ ----------- + --------------- + ------ + ----- + --------------------- + ---------------- +
| userid | int (11) | pri | 0 | auto_increment |
| username | char (20) ||||< br> | 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 |< br> + ----------- + ------------- + ------ + ----- + --------------------- + ---------------- +
if you think it is too difficult to create a database,
the statement for creating a database is:
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",
"hello, please go to ping Hui free space to view information! ", Now ();
insert into comment (username, sex, address, IP, post, OICQ, ICQ, telnumber, comment, time)
values ('pinghui', 'male', 'address', '2017. 0.0.1 ', 250100,2269101, 74875874, '2017-100',
' Hello, please go to ping Hui free space to view your message! Thank you! ', Now ();
it is more convenient to explain the following information with the database. Continue the establishment of the message book