一创建数据库
mysql> create database newsdb;
Query OK, 1 row affected (0.01 sec)
mysql> use newsdb;
Database changed
mysql> create table news(
-> id int unsigned not null auto_increment primary key,
-> title varchar(64) not null,
-> keywords varchar(64) not null,
-> author varchar(16) not null,
-> addtime int unsigned not null,
-> content text not null);
Query OK, 0 rows affected (0.77 sec)
mysql> desc news;
+----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| title | varchar(64) | NO | | NULL | | | keywords | varchar(64) | NO | | NULL | | | author | varchar(16) | NO | | NULL | | | addtime | int(10) unsigned | NO | | NULL | | | content | text | NO | | NULL | | +----------+------------------+------+-----+---------+----------------+
6 rows in set (0.06 sec)
二:创建php文件编写代码
1.dbconfig.php 公共配置信息文件,数据库连接配置信息
define("HOST","localhost");
define("USER","root");
define("PASS","root");
define("DBNAME","newsdb");
?>
2.menu.php 网站公共导航栏
新闻管理系统
3.index.php 浏览新闻文件