admin 管理员组

文章数量: 1086019

PHP+MySQL实现增删改查

这里用PHP和MySQL实现了一个新闻管理系统的增删改查的功能。

一、数据库

首先创建数据库

二、创建项目

1、我是在eclipse里面创建的PHP Project项目,项目目录如下:

这里需要在eclipse里面下载php插件才能创建PHP Project项目,下载插件就是的流程是:运行eclipse,在主界面里找到Help下的“Instal New Software”。然后在Work with中选择“All Available Sites”,到这里加载有些慢,需要耐心等待,然后选择web、xml、java EE、and OSGI…,在其中找到PHP Development Tools (PDT)软件。勾选,点击Next。重启eclipse就行了。
2、创建文件dbconfig.php,连接数据库

<?php
define("HOST", "localhost");
define("USER", "root");
define("PASS", "root");
define("DBNAME", "news");

3、创建主页显示文件index.php

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新闻后台管理系统</title>
</head>
<style type="text/css">
.wrapper {
	width: 1000px;
	margin: 20px auto;
}

h2 {
	text-align: center;
}

.add {
	margin-bottom: 20px;
}

.add a {
	text-decoration: none;
	color: #fff;
	background-color: red;
	padding: 6px;
	border-radius: 5px;
}

td {
	text-align: center;
}
</style>
<body>
	<div >
		<h2>新闻后台管理系统</h2>
		<div >
			<a href="addnews.php">增加新闻</a>
		</div>
		<table width="980px" border="1">
			<tr

本文标签: 管理系统 新闻 php MySQL