添加页面: 说明:这里只注重操作,对界面的美工没有下工夫,希望大家理解......
列表页面:
修改页面:
项目中所需的sql:
代码如下:
create database form; use form; CREATE TABLE `message` (
`id` tinyint(1) NOT NULL auto_increment,
`user` varchar(25) NOT NULL,
`title` varchar(50) NOT NULL,
`content` tinytext NOT NULL,
`lastdate` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=1 ;
conn.PHP `id` tinyint(1) NOT NULL auto_increment,
`user` varchar(25) NOT NULL,
`title` varchar(50) NOT NULL,
`content` tinytext NOT NULL,
`lastdate` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=1 ;
代码如下:
PHP
$conn = @ MysqL_connect("localhost","root","") or die("数据库链接错误");
MysqL_select_db("form",$conn);
MysqL_query("set names 'gbk'");
?>
$conn = @ MysqL_connect("localhost","root","") or die("数据库链接错误");
MysqL_select_db("form",$conn);
MysqL_query("set names 'gbk'");
?>
add.PHP
代码如下:
PHP
include 'conn.PHP';
if($_POST['submit']){
$sql="INSERT INTO message(id,user,title,content,lastdate) VALUES (NULL,'$_POST[user]','$_POST[title]','$_POST[content]',now())";
MysqL_query($sql); //页面跳转,实现方式为javascript
$url = "list.PHP";
echo "";
}
?>
include 'conn.PHP';
if($_POST['submit']){
$sql="INSERT INTO message(id,user,title,content,lastdate) VALUES (NULL,'$_POST[user]','$_POST[title]','$_POST[content]',now())";
MysqL_query($sql); //页面跳转,实现方式为javascript
$url = "list.PHP";
echo "";
}
?>
list.PHP
代码如下:
PHP
include 'conn.PHP';
?>
PHP
echo "";
?>
PHP
include 'conn.PHP';
?>
PHP
echo "";
?>
标题: 用户: |
内容:=$row[content]?> |
delete.PHP
代码如下:
PHP
include 'conn.PHP';
$id = $_GET['id'];
$query="delete from message where id=".$id;
MysqL_query($query);
?>
PHP
//页面跳转,实现方式为javascript
$url = "list.PHP";
echo "";
?>
include 'conn.PHP';
$id = $_GET['id'];
$query="delete from message where id=".$id;
MysqL_query($query);
?>
PHP
//页面跳转,实现方式为javascript
$url = "list.PHP";
echo "";
?>
preEdit.PHP
代码如下:
PHP
include 'conn.PHP';
$id=$_GET[id];
$query="SELECT * FROM message WHERE id =".$id;
$result=MysqL_query($query);
while ($rs=MysqL_fetch_array($result)){
?>
include 'conn.PHP';
$id=$_GET[id];
$query="SELECT * FROM message WHERE id =".$id;
$result=MysqL_query($query);
while ($rs=MysqL_fetch_array($result)){
?>
postEdit.PHP
代码如下:
原文链接:https://www.f2er.com/php/27234.html