PHP+MySQL实现新闻管理系统

本文介绍了使用PHP和MySQL创建新闻管理系统的过程,包括数据库的创建、PHP项目在Eclipse中的搭建,以及增删改查功能的实现。通过dbconfig.php连接数据库,创建index.php、addnews.php、action-addnews.php、action-del.php和editnews.php等文件,实现了系统的功能。运行地址为http://localhost/PHPProject/index.php。
摘要由CSDN通过智能技术生成

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 class="wrapper">
		<h2>新闻后台管理系统</h2>
		<div class="add">
			<a href="addnews.php">增加新闻</a>
		</div>
		<table width="980px" border="1">
			<tr
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值